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

curl-and-php

RE: Curl error 7 while accessing a subdomain

From: Rakhy Sunny <rakhysunny_at_hotmail.com>
Date: Sat, 15 Nov 2008 04:18:31 +0000

Thanks Adeel for the suggestion, but adding code line is also returning me the same error.

One more info i forgot to add in my first mail is, if i try this code from another machine then it will retrieve me the output. Like the problem seems to be when the URL https://www.mysite.com/payment.php try to access https://www.mysite.com/payment/FEServlet?NameXsl=default&getDynamicString=XML, which are both sitting in the same machine.

Thanks
Rakhy

Date: Sat, 15 Nov 2008 00:42:20 +0500
From: imadeelshahid_at_gmail.com
To: curl-and-php_at_cool.haxx.se
Subject: Re: Curl error 7 while accessing a subdomain

add curl_setopt($ch, CURLOPT_VERIFYHOST, FALSE);

to see if it works as that is one it is missing for ssl curl retrieval

2008/11/14 Rakhy Sunny <rakhysunny_at_hotmail.com>

Hi,

I am getting the curl error "CURL error #7: couldn't connect to host" when i am trying to access a subdomain URL with SSL.

My cURL and SSL version goes like follows = "libcurl/7.16.0 OpenSSL/0.9.8g zlib/1.2.3".

My situation on using cURL is like follows. I have a website which is running in SSL. Consider my site URL is https://www.mysite.com. Now there is an application running in the same machine which is accessible using a web URL and the URL for accessing that site is https://www.mysite.com/payment/FEServlet?NameXsl=default&getDynamicString=XML. In a page of https://www.mysite.com/payment.php i am accessing the https://www.mysite.com/payment/FEServlet?NameXsl=default&getDynamicString=XML URL using cURL and it gives me a "CURL error #7: couldn't connect to host" error. I am supposed to get an XML response for thsi URL.

The URL https://www.mysite.com/payment/FEServlet?NameXsl=default&getDynamicString=XML, if i copy paste in the browser will show me the correct XML response. But when accessing via php page with cURL it gives me this error.

There is no port involved except one for SSL which is 443 and it is made accessible via the firewall.

The code snipet used for this is as follows:

<?php
$cookies_file = "cookie_test.txt";

$url = "https://www.mysite.com/payment/FEServlet?NameXsl=default&getDynamicString=XML";
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT,20);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies_file);

$changePass_data = curl_exec($ch);
if (curl_error($ch)){
print "CURL error #" . curl_errno($ch) . ": " . curl_error($ch);
}
?>

What might be the work around for this issue or a possible solution?

Thanks
Rakhy

Give the world a slice of your life. Get a Live.in id Check it out!

_______________________________________________

http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

_________________________________________________________________
Register once and play all contests. Increase your scores with bonus credits for logging in daily on MSN.
http://specials.msn.co.in/msncontest/index.aspx

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-11-15