Having issues using cURL on windows vista. The library is there and showing with phpinfo(), but curl_exec() is not returning the web page content - when uploaded and tested on a linux server there's no problems with the same code, returns the data as expected.
Does anyone have any experience with this/ideas? I'm using xampp and php 5.2.6.
UPDATE:
Array( [url] => https://graph.facebook.com/me
[content_type] => [http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0
[connect_time] => 0.203
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_len开发者_Go百科gth] => -1
[starttransfer_time] => 0
[redirect_time] => 0 )
Is the response I get from print_r(curl_getinfo($ch));
I noticed that's a https
address.
Try doing this:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Setting that to false allows Curl
to accept any CA
.
You can check the documentation here:
http://php.net/manual/en/function.curl-setopt.php
CURLOPT_SSL_VERIFYPEER
FALSE to stop cURL from verifying the peer's certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option. CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2).
I think you should change: [url] => https://graph.facebook.com/me
to
[url] => "https://graph.facebook.com/me"
I assume that you are using commas to separate the key-value pairs in php array.
精彩评论