我需要這個cURL命令轉換成PHP代碼捲曲:捲曲的命令行翻譯成PHP捲曲
> curl --get 'https://api.twitter.com/1/followers/ids.json' --data > 'cursor=-1&screen_name=somename' --header 'Authorization: OAuth > oauth_consumer_key="key", oauth_nonce="nonce", > oauth_signature="signature", oauth_signature_method="HMAC-SHA1", > oauth_timestamp="timestamp", oauth_token="token", oauth_version="1.0"' > --verbose
我已經試過這一點,但它似乎不工作:
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: OAuth oauth_consumer_key="key", oauth_nonce="nonce", oauth_signature="signature", oauth_signature_method="HMAC-SHA1", oauth_timestamp="timestamp", oauth_token="token", oauth_version="1.0"'));
> curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
> curl_setopt($ch, CURLOPT_VERBOSE, 1);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_HTTPGET, 1);
> curl_setopt($ch, CURLOPT_URL, 'https://api.twitter.com/1/users/show.json?cursor=-1&screen_name=somename');
> $page = curl_exec($ch);
> curl_close($ch);
錯誤我得到
SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
但它工作在標準curl命令
http://php.net/manual/en/book.curl.php –
你得到什麼錯誤? –
SSL證書問題,請驗證CA證書是否正常。詳細信息:錯誤:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:證書驗證失敗 - 但它在標準curl命令中工作** – loudislav