473,837 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
+ 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_C ONNECT (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.co m/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_SSLVERS ION, 2); since
there was mention somewhere that might help, but same problem occurs.

help greatly appreciated.

- Rory

Jan 9 '06 #1
1 6628
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_OPERATIO N_TIMEOUTED (28) or CURLE_COULDNT_C ONNECT (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($c h, CURLOPT_URL, "https://myserviceall.co m/index.php");
// any old https page
curl_setopt($c h, 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_SSLVERS ION, 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_VER IFYPEER, 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
3340
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 linux that's only like 3 months old (fedora c2 stable), because curl needs libcrypto.so.4. 3. In order to install libcrypto.so.4 I have to upgrade my openssl (took me forever to figure that out).
9
8772
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 you go to any page in the "member" area without logging in you get directed to a https connection and hit login.php (ie: you end up at https://www.domain.com/login.php). The problem, I believe, lies in the fact that the form on that page...
3
5094
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 tried but the result is always the login page. $curl=curl_init(); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
0
668
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 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...
1
13268
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 of the web page that gets returned from the curl form completion. The page I am trying to access is https://retire.hartfordlife.com/index.html and the html block that contains the form is: <form method="post" name="form1"...
0
10718
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 am using Apache server/Linux platform and started server with "server certificate". I configured server to listen HTTPS service at port 443. I downloaded download.txt correctly from server using command as $curl --cacert cacert.pem ...
0
5865
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... http://groups.google.co.uk/group/comp.lang.php/browse_thread/thread/2e052386da903425/b03ec83ac55273a2?lnk=st&q=&rnum=1#b03ec83ac55273a2 Everyone on that post seems to say its to do with the cookie's, yet if infact they had tried this script they would have found that even with the cookies enabled this...
17
8092
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 = ' https://verisign.com'; $ch = curl_init(); curl_setopt($ch, CURLOPT_TIMEOUT, 10);
3
15677
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 setting CURLOPT_FOLLOWLOCATION set to true. I had a problem with my host's updating something in the past that gave me the error "CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set". My host worked on the...
0
9846
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9412
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7814
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7007
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5674
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5852
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4050
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3126
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.