如何在PHP中调用cURL代码中的语法错误?

时间:2016-05-02 15:54:38

标签: php curl oauth

<?php

    $oauth = array(OAuth oauth_consumer_key="9N7dVnXmOldmxrUDspHvWFbLs", oauth_nonce="688a87bf27008744490d42631e785d16", oauth_signature="vpXXl8lV0XvoG33J0t7Xc06RcrA%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1462202214", oauth_token="2936160236-wbvkaZjriGRQwxw6LhFdCnjEdNmE7xSOzmZt8t7", oauth_version="1.0");

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://api.twitter.com/1.1/trends/place.json?id=1");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_HTTPHEADER, $oauth);
    $response = curl_exec($ch);
    curl_close($ch);

    print_r($response);
    $data = json_decode($response,true);
    print_r($data);

    var_dump($data);

?>

错误是

  

解析错误:语法错误,意外&#39; oauth_consumer_key&#39; (T_STRING),期待&#39;)&#39;在第3行的C:\ wamp \ www \ gg.php

0 个答案:

没有答案