|
Posted by Chuck Anderson on 01/09/06 20:37
Rory wrote:
>I'm just starting to use cURL and having trouble accessing https pages.
> All I want to do at this stage is get an https page and display it,
>just to test the https get is working. However, I always get either a
>CURLE_OPERATION_TIMEOUTED (28) or CURLE_COULDNT_CONNECT (7) error.
>I can see from phpinfo() that cURL and SSL are installed, as follows:
> CURL support enabled
> CURL Information libcurl/7.12.0 OpenSSL/0.9.6b zlib/1.1.4
>but my code that works fine for an http call doesn't work for an https
>call. Any suggestions on what I might be doing wrong or what might be
>stopping the call from working? I'm on a hosted site so I don't have
>command line access.
>PHP Version 4.3.10, running on linux & apache.
>
>here's the code I'm running:
><?php
>$ch = curl_init();
>curl_setopt($ch, CURLOPT_URL, "https://myserviceall.com/index.php");
>// any old https page
>curl_setopt($ch, CURLOPT_TIMEOUT,10);
>$result = curl_exec ($ch);
>if (curl_error($ch)){
> print "<br>error #" . curl_errno($ch) . ": " . curl_error($ch);
>}
>curl_close ($ch);
>print $result;
>
>print "<br>end<br>";
>
>phpinfo();
>?>
>
>Same code works fine for an http url.
>
>I've also tried calling curl_setopt( $ch, CURLOPT_SSLVERSION, 2); since
>there was mention somewhere that might help, but same problem occurs.
>
>help greatly appreciated.
>
>- Rory
>
>
>
Try adding this option:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
A tutorial that I found said it was necessary (and it worked for me).
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
Navigation:
[Reply to this message]
|