curl-and-php
Re: Curl and PHP - HTTP 503 (Service Unavailable)
Date: Tue, 28 Apr 2009 08:44:44 +0530
Hi Marcos,
Just after posting this i was able to resolve the problem, actually if we
want to read the header even if the site return error message, we need to
make CURLOPT_FAILONERROR to false.
Thanks for the help,
Regards.
Deeps
On Tue, Apr 28, 2009 at 8:39 AM, D M <deep0mal_at_gmail.com> wrote:
> Hi Marcos,
>
> Thanks for the reply, here is my script
>
> $c = curl_init("http://10.225.148.183/y.php");
> curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($c, CURLOPT_FAILONERROR, true);
> curl_setopt($c, CURLOPT_HEADER, true);
>
> $responseMessage = curl_exec($c);
> print_r($responseMessage);
> if(!$responseMessage) {
> print_r(curl_error($c));
> }
>
> print_r(curl_getinfo($c));
> curl_close($c);
>
> If the site is returning 200 response, I can get the headers also but if it
> returns any other error status, it does not give headers.
>
> I am using Windows XP, PHP 5.2.2, curl 7.16
>
> Regards,
> Deeps
>
>
> On Mon, Apr 27, 2009 at 11:46 PM, Marcos Santos Junior <msjunior_at_gmail.com
> > wrote:
>
>> I'm use "CURLOPT_HEADER=true" here and it works fine on Vista Ultimate
>> PHP5.2.8, Curl 7.16.0.
>> show ur script then I'll might me able to clear up things 4u
>>
>> Best
>>
>>
>>
>> 2009/4/27 D M <deep0mal_at_gmail.com>
>>
>>> Hi Guys,
>>> I am trying to handle the HTTP 503 error. I want to read the Retry-After
>>> header which come along with the response headers of 503 Service
>>> unavailable. I am using curl extension for PHP. The problem is even i am
>>> setting CURLOPT_HEADER as true still i am not able to get the headers. Is
>>> this the default behavior of curl extension in PHP? Is there a way to get
>>> these headers somehow?
>>>
>>> Any help would be appreciated.
>>>
>>> Thanks n Regards,
>>> Deeps
>>>
>>> _______________________________________________
>>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>>>
>>>
>>
>> _______________________________________________
>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>>
>>
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-04-28