Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created April 20, 2012 10:01
Show Gist options
  • Select an option

  • Save thinkphp/2427460 to your computer and use it in GitHub Desktop.

Select an option

Save thinkphp/2427460 to your computer and use it in GitHub Desktop.
Usage Flickr Service
$endpoint = 'http://thinkphp.ro/apps/ishackday/jsonservice/flickr.php/get?text=beach';
$json = json_decode(get($endpoint));
$response = $json->response;
function get($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$head = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $head;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment