php中的Twitter搜索api(使用curl)总是返回null

时间:2013-03-29 15:48:34

标签: php twitter

我正在尝试使用twiiter api通过cURL在php中使用以下代码来获取推文,但它似乎总是返回NULL。

//$urlfetch = "https://search.twitter.com/search.json?q= geocode:".round($_GET['param1'],4).",".round($_GET['param2'],4).",25mi"; 

$urlfetch = "https://api.twitter.com/1/geo/search.json?query=Toronto"; 

    echo urlencode($urlfetch);
    echo $urlfetch;

    $ch = curl_init();
    $timeout = 30; // set to zero for no timeout
    curl_setopt ($ch, CURLOPT_URL, $urlfetch);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    curl_setopt ($ch, CURLOPT_PROXY, "10.3.100.209:8080");
    $response = curl_exec($ch);
    curl_close($ch);
    echo "<br />";
    var_dump($response);
    $response = json_decode($response);
    echo "<br />";
    var_dump($response);

编辑:     for $ urlfetch =“https://search.twitter.com/search.json?q=%20geocode:40.7,73.9,25mi”;     使用相同代理从浏览器输入时http://pastebin.com/jQ9S2gV4处的响应。

0 个答案:

没有答案