|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-10-31 10:51 UTC] p dot vanbrouwershaven at networking4all dot com
Description:
------------
I have some problems with the curl. On the console I get the right
response message but in PHP I see no difference between a valid and an
invalid SSL Certificate.
Curl command in PHP:
$url = ' https://verisign.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLE_OPERATION_TIMEOUTED, 10);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$result = curl_exec ($ch);
$info = curl_getinfo($ch);
curl_close ($ch);
print_r($info);
Curl command on console:
curl -I https://verisign.com
Console result:
curl -I https://verisign.com
curl: (51) SSL: certificate subject name 'www.verisign.com' does not
match target host name 'verisign.com'
PHP Result:
[ssl_verify_result] => 0
Reproduce code:
---------------
$url = ' https://verisign.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLE_OPERATION_TIMEOUTED, 10);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
$result = curl_exec ($ch);
$info = curl_getinfo($ch);
curl_close ($ch);
print_r($info);
Expected result:
----------------
Array
(
[url] => https://verisign.com
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 51
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 0
[redirect_time] => 0
)
Actual result:
--------------
Array
(
[url] => https://verisign.com
[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
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 0
[redirect_time] => 0
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 12:00:01 2025 UTC |
I tried with php5.2-200807211030 but the problem still exists. curl_error returns: SSL: certificate subject name 'www.verisign.com' does not match target host name 'verisign.com' curl_getinfo returns: Array ( [url] => https://verisign.com/ [content_type] => text/html [http_code] => 301 [header_size] => 182 [request_size] => 135 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.072121 [namelookup_time] => 0.184282 [connect_time] => 0.342402 [pretransfer_time] => 0.905169 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => 0 [upload_content_length] => 0 [starttransfer_time] => 1.07203 [redirect_time] => 0 [certinfo] => )