如何从gowalla网址获取内容?

时间:2011-07-06 19:28:22

标签: php javascript

如何从php或javascript中的gowalla url获取内容? 像这样: http://api.gowalla.com/spots?lat=30.2697&lng=-97.7494&radius=50

1 个答案:

答案 0 :(得分:0)

尝试使用这些功能:

  1. 使用cURL

    function get_data($ url) {   $ ch = curl_init();   $ timeout = 5;   curl_setopt($ CH,CURLOPT_URL,$网址);   curl_setopt($ CH,CURLOPT_RETURNTRANSFER,1);   curl_setopt($ CH,CURLOPT_CONNECTTIMEOUT,$超时);   $ data = curl_exec($ ch);   curl_close($ CH);   返回$ data; }

    $ returned_content = get_data('http://api.gowalla.com/spots?lat=30.2697&lng=-97.7494&radius=50');

  2. 使用file_get_contents

    $ url =“http://api.gowalla.com/spots?lat=30.2697&lng=-97.7494&radius=50”; $ str = file_get_contents($ url);

  3. 您也可以使用以下网址提供帮助:http://nadeausoftware.com/articles/2007/06/php_tip_how_get_web_page_using_curl

相关问题