You are here: Re: CURL: Result on console and in PHP are different « PHP Programming Language « IT news, forums, messages
Re: CURL: Result on console and in PHP are different

Posted by Rik Wasmus on 10/31/07 11:22

On Wed, 31 Oct 2007 11:30:37 +0100, Paul van Brouwershaven =

<p.vanbrouwershaven@gmail.com> wrote:

> On Oct 31, 11:21 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> Yes, the certificate is set up forwww.verisign.com, so when you try t=
o
>> go to verisign.com you get a name mismatch and it fails.
>>
>> FYI, Firefox shows a message indicating the mismatch when you try to =
=

>> https://verisign.com, also.
> Yes I know, thats the reason I try https://verisign.com but PHP is not=

> giving me the error message/number in the [ssl_verify_result] value.
>
> I also tried:
>
> $url =3D ' https://www.verisign.com';
>
> $ch =3D 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);
> curl_setopt($ch, CURLOPT_CAINFO, '/usr/share/curl/cacert.pem');
> curl_setopt($ch, CURLOPT_CAPATH, '/usr/share/curl/cacert.pem');
> curl_setopt($ch, CURL_CA_BUNDLE, '/usr/share/curl/cacert.pem');
>
> $result =3D curl_exec ($ch);
> $info =3D curl_getinfo($ch);
> curl_close ($ch);
>
> print_r($info);


<?php
//notice it doesn't start with a space...
$url =3D 'https://www.verisign.com';

$ch =3D 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 =3D curl_exec ($ch);
if(!$result) echo curl_error($ch);
$info =3D curl_getinfo($ch);
curl_close ($ch);

print_r($info);
?>



-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация