开发者

How to get content from gowalla url?

开发者 https://www.devze.com 2023-03-17 14:59 出处:网络
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=50Try using these functions:

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:

  1. 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');

  2. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消