Jump to content

phphelpme

Members
  • Posts

    14
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

phphelpme's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. this is what happens in gethttpclientresponst() class CurlHttpClient { /** * Default User-Agent * @var string */ const DEFAULT_USER_AGENT = ''; /** * Used HTTP request methods */ const GET = 'GET'; const POST = 'POST'; const DELETE = 'DELETE'; /** * cURL handler * @var resource */ private $handler; /** * Store the POST fields */ private $postParams = array(); /** * Initiate a cURL session * @param string $url */ public function __construct($uri) { $this->handler = curl_init($uri); $this->_setOptions(); } protected function _setOptions() { curl_setopt($this->handler, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->handler, CURLOPT_FOLLOWLOCATION, true); curl_setopt($this->handler, CURLOPT_USERAGENT, self::DEFAULT_USER_AGENT); } /** * Set the URI * @param $uri */ public function setUri($uri) { $this->handler = curl_init($uri); $this->_setOptions(); } /** * Receive the response with full headers * @param boolean $value */ public function setHeaders($value = true) { curl_setopt($this->handler, CURLOPT_HEADER, $value); } /** * Set the HTTP request method * @param string $method */ public function setMethod($method = self::GET) { switch ($method) { case self::GET : curl_setopt($this->handler, CURLOPT_HTTPGET, true); break; case self::POST : curl_setopt($this->handler, CURLOPT_POST, true); break; case self::DELETE : curl_setopt($this->handler, CURLOPT_CUSTOMREQUEST, self::DELETE); break; default: throw new CurlHttpClientException('Method not supported'); } } /** * Add a new post param to the set * @param string $name * @param mixed $value */ public function setPostParam($name, $value) { $this->postParams[$name] = $value; curl_setopt($this->handler, CURLOPT_POSTFIELDS, $this->postParams); } /** * Get the response * @return string */ public function getResponse() { $response = curl_exec($this->handler); curl_close($this->handler); return $response; } /** * Extract the headers from a response string * * @param string $response * @return mixed[] */ protected function extractHeaders($response) { $headers = array(); // First, split body and headers $parts = preg_split('|(?:\r?\n){2}|m', $response_str, 2); if (!$parts[0]) return $headers; // Split headers part to lines $lines = explode("\n", $parts[0]); unset($parts); $last_header = null; foreach($lines as $line) { $line = trim($line, "\r\n"); if ($line == "") break; // Locate headers like 'Location: ...' and 'Location:...' (note the missing space) if (preg_match("|^([\w-]+):\s*(.+)|", $line, $m)) { unset($last_header); $h_name = strtolower($m[1]); $h_value = $m[2]; if (isset($headers[$h_name])) { if (! is_array($headers[$h_name])) { $headers[$h_name] = array($headers[$h_name]); } $headers[$h_name][] = $h_value; } else { $headers[$h_name] = $h_value; } $last_header = $h_name; } else if (preg_match("|^\s+(.+)$|", $line, $m) && $last_header !== null) { if (is_array($headers[$last_header])) { end($headers[$last_header]); $last_header_key = key($headers[$last_header]); $headers[$last_header][$last_header_key] .= $m[1]; } else { $headers[$last_header] .= $m[1]; } } } return $headers; } } class CurlHttpClientException extends Exception {} here is what endpointUrl is protected $_endpointUrls = array( 'authorize' => 'https://api.instagram.com/oauth/authorize/?client_id=%s&redirect_uri=%s&response_type=%s', 'access_token' => 'https://api.instagram.com/oauth/access_token', 'user' => 'https://api.instagram.com/v1/users/%d/?access_token=%s', 'user_feed' => 'https://api.instagram.com/v1/users/self/feed?%s', 'user_recent' => 'https://api.instagram.com/v1/users/%s/media/recent/?access_token=%s&max_id=%s&min_id=%s&max_timestamp=%s&min_timestamp=%s', 'user_search' => 'https://api.instagram.com/v1/users/search?q=%s&access_token=%s', 'user_follows' => 'https://api.instagram.com/v1/users/%d/follows?access_token=%s&cursor=%s', 'user_followed_by' => 'https://api.instagram.com/v1/users/%d/followed-by?access_token=%s', 'user_requested_by' => 'https://api.instagram.com/v1/users/self/requested-by?access_token=%s', 'user_relationship' => 'https://api.instagram.com/v1/users/%d/relationship?access_token=%s', 'modify_user_relationship' => 'https://api.instagram.com/v1/users/%d/relationship?action=%s&access_token=%s', 'media' => 'https://api.instagram.com/v1/media/%d?access_token=%s', 'media_search' => 'https://api.instagram.com/v1/media/search?lat=%s&lng=%s&max_timestamp=%s&min_timestamp=%s&distance=%s&access_token=%s', 'media_popular' => 'https://api.instagram.com/v1/media/popular?access_token=%s', 'media_comments' => 'https://api.instagram.com/v1/media/%d/comments?access_token=%s', 'post_media_comment' => 'https://api.instagram.com/v1/media/%d/comments?access_token=%s', 'delete_media_comment' => 'https://api.instagram.com/v1/media/%d/comments?comment_id=%d&access_token=%s', 'likes' => 'https://api.instagram.com/v1/media/%d/likes?access_token=%s', 'post_like' => 'https://api.instagram.com/v1/media/%d/likes', 'remove_like' => 'https://api.instagram.com/v1/media/%d/likes?access_token=%s', 'tags' => 'https://api.instagram.com/v1/tags/%s?access_token=%s', 'tags_recent' => 'https://api.instagram.com/v1/tags/%s/media/recent?max_id=%s&min_id=%s&access_token=%s', 'tags_search' => 'https://api.instagram.com/v1/tags/search?q=%s&access_token=%s', 'locations' => 'https://api.instagram.com/v1/locations/%d?access_token=%s', 'locations_recent' => 'https://api.instagram.com/v1/locations/%d/media/recent/?max_id=%s&min_id=%s&max_timestamp=%s&min_timestamp=%s&access_token=%s', 'locations_search' => 'https://api.instagram.com/v1/locations/search?lat=%s&lng=%s&foursquare_id=%s&distance=%s&access_token=%s', ); Just the links for the different things to do on instagram
  2. seriously i dont even know right now ... would you like to see my pages ??
  3. i am trying to load the current users images from instagrams api. i got there user id and other things but i cant seem to get the recent media that they posted ... here is the codes im using protected $_endpointUrls = array( 'authorize' => 'https://api.instagram.com/oauth/authorize/?client_id=%s&redirect_uri=%s&response_type=%s', 'access_token' => 'https://api.instagram.com/oauth/access_token', 'user' => 'https://api.instagram.com/v1/users/%d/?access_token=%s', 'user_feed' => 'https://api.instagram.com/v1/users/self/feed?%s', 'user_recent' => 'https://api.instagram.com/v1/users/%s/media/recent/?access_token=%s&max_id=%s&min_id=%s&max_timestamp=%s&min_timestamp=%s',); public function getUserRecent($id, $maxId = '', $minId = '', $maxTimestamp = '', $minTimestamp = '') { $endpointUrl = sprintf($this->_endpointUrls['user_recent'], $id, $this->getAccessToken(), $maxId, $minId, $maxTimestamp, $minTimestamp); $this->_initHttpClient($endpointUrl); return $this->_getHttpClientResponse(); } this is where i call upon those two to get the users photos but it wont display them <? $userphotos = $instagram-> getUserRecent($_SESSION['InstagramAccessToken']); $photos = json_decode($userphotos, true); ?> <?= $photos['data']['user']['user_recent'] ?>
  4. im working with instagrams api and im not sure what to do next ... i so far have there access_token , but i dont know how to get the rest of the users information. the code below is given to me by instagram to retrieve the users information but i dont know what language to use it with , i have tried php but i dont know what to do with it ? please help thank you i have the access token , client id , client secret , and redirect uri. but do i change the CODE to a variable for the token ? curl \-F 'client_id=CLIENT-ID' \ -F 'client_secret=CLIENT-SECRET' \ -F 'grant_type=authorization_code' \ -F 'redirect_uri=YOUR-REDIRECT-URI' \ -F 'code=CODE' \https://api.instagram.com/oauth/access_token
  5. hi im working with instagram API and it uses Curl ... i sorta get it but is there a site where i could learn more or anyone here that knows about curl?
  6. im trying to grab something from the url bar , a phrase but it wont show up ?? please help ! <script type='text/javascript' src='jquery.min.js'></script> <script> function myFunction(sender) { var id = '#' + sender.getAttribute('href').split('#')[1]; or `'#' + sender.href.split('#')[1]` or `'#' + $(sender).attr('href').split('#')[1]` } </script> Copy and paste code from This page into the code box on the homepage and go claim your likes!!!<br> Your code is <script> document.write(myFunction()) </script>
  7. actually its the instagram api token so they control it , not me sorry
  8. the url is shortend for some reason ? its http://localhost/instalike/code.php#access_token=263222910.4d15ef2.0b42098ba3b845b9940af5b4687274ef
  9. phphelpme

    Help

    alright , do you know how to get the section from the url , the token part and turn that into a variable ? example would be like this they instert the url here <form action="list.php" method="post"> <input name="token" type="text" style="width:200px;"/> <input type="submit" class="btn btn btn-info btn-mini" value="Login" /> </form> and then on list.php it seperates the token and makes it a variable the url looks like this http://localhost/instalike/code.php#access_token=263222910.4d15ef2.0b42098ba3b845b9940af5b46i just need the access_token i just need the access_token each access token will be different
  10. i need to know how to make the php code to insert what ever they picked out of these options , insert in to the database for gender and what ever gender they picked will determine there profile , please help! <label for="Gender">Gender:</label> </div><div align="left"><select class="select" name="sex" id="sex"> <option value="0">Select Gender</option> <option value="1">Female</option> <option value="2">Male</option></select></div>
  11. i need to know how to make the php code to insert what ever they picked out of these options <label for="Gender">Gender:</label> </div><div align="left"><select class="select" name="sex" id="sex"> <option value="0">Select Gender</option> <option value="1">Female</option> <option value="2">Male</option></select></div>
  12. how do i insert this into a database? i need the php code please. <select class="select" name="sex" id="sex"> <option value="0">Select Gender</option> <option value="1">Female</option> <option value="2">Male</option></select> I need it to insert what ever one they select Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.