cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

problem accessing HTTPS file using PHP/curl

From: justin worrall <justinworrall_at_clara.co.uk>
Date: Sun, 21 Dec 2003 18:36:17 +0000

Hi,

I can access a file fine using curl from the command line:

curl
"https://www.cantorsport.co.uk/live_prices/
prices.cfm?level_1=football&level_2=La%20Liga&level_3=Long%20Term%20Inde
x"

but trying to do the same via PHP results in a blank return:

<?php

$name='https://www.cantorsport.co.uk/live_prices/
prices.cfm?level_1=football&level_2=La%20Liga%20Long%20Term&level_3=Inde
x';

$fh = fopen('/tmp/log.txt','w') or die($php_errormsg);
$c = curl_init($name);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_VERBOSE,1);
curl_setopt($c, CURLOPT_STDERR, $fh);
$page = curl_exec($c);
curl_close($c);
fclose($fh) or die($php_errormsg);

$length=strlen($page);
echo "'$name' is $length characters long";
?>

Looking in the log, I get the following:

* About to connect() to www.cantorsport.co.uk:443
* Connected to www.cantorsport.co.uk (148.106.132.82) port 443
* error setting cerficate verify locations* Closing connection #0

I was thinking this is likely certificate related (I'm an https/ssl
newbie), but it's not clear to me why this might work from the command
line but not PHP.

I'm using curl 7.7.2 (powerpc-apple-darwin6.0) libcurl 7.7.2 (OpenSSL
0.9.6b)

tia,

Justin

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-21