How to get content from gowalla url?
How to get content from gowalla url in php or javascript? Like this: http://api.gowalla.com开发者_JAVA技巧/spots?lat=30.2697&lng=-97.7494&radius=50
Try using these functions:
Using cURL
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; }
$returned_content = get_data('http://api.gowalla.com/spots?lat=30.2697&lng=-97.7494&radius=50');
Using file_get_contents
$url = "http://api.gowalla.com/spots?lat=30.2697&lng=-97.7494&radius=50"; $str = file_get_contents($url);
You can also help with this URL: http://nadeausoftware.com/articles/2007/06/php_tip_how_get_web_page_using_curl
精彩评论