Skip to content

Instantly share code, notes, and snippets.

@xyqfer
Created September 28, 2013 07:31
Show Gist options
  • Select an option

  • Save xyqfer/6739537 to your computer and use it in GitHub Desktop.

Select an option

Save xyqfer/6739537 to your computer and use it in GitHub Desktop.
php-curl
<?php
$url='http://twitter.com/statuses/user_timeline/16387631.json'; //rss link for the twitter timeline
print_r(get_data($url)); //dumps the content, you can manipulate as you wish to
/* gets the data from a URL */
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment