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

curl-and-php

Re: Curl error 7 while accessing a subdomain

From: adeel shahid <imadeelshahid_at_gmail.com>
Date: Sat, 15 Nov 2008 13:29:35 +0500

Two possible ideas,

1 - Check permissions of CookieFile.php if it's write by your php script
2 - Their might be a redirect in your request at the server end when you
connect via curl to retrieve data so use curl_setopt($ch,
CURLOPT_FOLLOWLOCATION, true);

also, if you can kindly display the error message so I can get a little bit
better idea to debug the problem.

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

> 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=XMLURL 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!<https://signup.live.com/signup.aspx?mkt=en-in&rollrs=12&lic=1>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>
>
> ------------------------------
> Team India gets set to thwart Australia's quest for the final frontier.
> Catch the action on MSN Try it now! <http://sports.in.msn.com/>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>

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