function createComment($comment, $post_id, $id, $user_key) { $url = $this->api_url . 'create_comment.json'; $post_data['post_id'] = $post_id; $post_data['body'] = $comment; $post_data['akey'] = $this->api_key; $post_data['ukey'] = $this->createUserKey($user_key); $post_data['uid'] = $id; foreach ($post_data as $name => $val) { $body .= '&' . $name . '=' . urlencode($val); } $body = substr($body, 1); $headers = array('User-Agent' => $this->useragent); $content = $this->getRemoteResource($url, $body, 3, 'POST', 'application/x-www-form-urlencoded', $headers); // JSON 디코딩 $json = new Services_JSON_SocialXE(); $output = $json->decode($content); if ($output) { return $output; } else { $result->error = $content; return $result; } }
function setAutoLoginKey($auto_login_key) { $this->session->setSession('auto_login_key', $auto_login_key); // 소셜XE 서버에서 세션을 받아 세팅한다. // 데이터 준비 $data = array('auto_login_key' => $auto_login_key); // 요청 URL 생성 $url = $this->getURL('getsession', $data); // 요청 $content = $this->httpRequest($url); //JSON 디코딩 $json = new Services_JSON_SocialXE(); $output = $json->decode($content); // 세션 세팅 if ($output->session) { $this->session->setFullSession($output->session); } // 서비스 로그인 여부 싱크 $this->providerManager->syncLogin(); }
/** * Get the results from a bit.ly service interaction. * * @param string $url The URL to interact with, the action of the interaction * will be contained within the URL. * @param boolean $errors Passed by the errors() function and forces this function * to use json as the format. * * @return boolean True if everything has worked, otherwise false. */ function getResult($bitlyurl, $errors = false) { if ($errors) { $tmpFormat = $this->format; $this->format = 'json'; } if ($this->format == 'json') { $content = FileHandler::getRemoteResource($bitlyurl); $json = new Services_JSON_SocialXE(); $results = $json->decode($content); // array로 $results = $this->objectToArray($results); } if ($errors) { $this->format = $tmpFormat; } if ($results['statusCode'] != 'OK') { $this->errors = $results; return false; } if ($errors) { // Save everything in the results array $this->results = $results['results']; } else { // Save the first item in the results array $this->results = current($results['results']); } return true; }