473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 6514
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.