473,466 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

problems using cURL to access https

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

Jan 9 '06 #1
1 6525
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.
*****************************
Jan 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: mrbog | last post by:
1. In order to make an http (or https) request with PHP, I need to recompile php with cURL. 2. In order to install CURL I have to upgrade my openssl rpm, even though I'm runing a version of...
9
by: Dave Martin | last post by:
I've successfully used CURL to maneuver around and through sites but a new site I've been trying to work with has got me stumped. To retrieve the data I'm trying to get a login is required. If...
3
by: Hans | last post by:
Hi everybody, I am desperately trying to log into my account at godaddy.com with PHP and Curl and just cannot make it happen. Has anybody written a script for this purpose? Here is what I...
0
by: Rory | last post by:
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...
1
by: ynotssor | last post by:
Hello, can someone please tell me the correct way to use "curl" to complete an online form? I am trying to eventually retrieve my account balance via a cron job that will email me the parsed output...
0
by: mahesh anasuri | last post by:
Hi all, I am new to this mailing list. Thankful if any one is using curl/linux version to and worked on Https. I have created certificates (PEM format) for client and server using openSSL. I...
0
by: nfhm2k | last post by:
I've been trying to find a solution to this for quite some time now... I even took a look at existing scripts... Including this one......
17
by: Paul van Brouwershaven | last post by:
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 =...
3
by: Sarah | last post by:
I was wondering if someone might be able to help me with this issue. I have a feeling this has something to do with my host's server settings as I used to be able to get CURL to follow redirects by...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.