Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10041 > unrolled thread

cURL and response code 302

Started bybill <william@TechServSys.com>
First post2013-07-08 11:35 -0400
Last post2014-04-10 10:23 -0700
Articles 17 — 5 participants

Back to article view | Back to comp.lang.php


Contents

  cURL and response code 302 bill <william@TechServSys.com> - 2013-07-08 11:35 -0400
    Re: cURL and response code 302 Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-07-08 09:02 -0700
      Re: cURL and response code 302 bill <william@TechServSys.com> - 2013-07-09 10:09 -0400
        Re: cURL and response code 302 Arno Welzel <usenet@arnowelzel.de> - 2013-07-09 16:24 +0200
          Re: cURL and response code 302 bill <william@TechServSys.com> - 2013-07-09 10:51 -0400
            Re: cURL and response code 302 Arno Welzel <usenet@arnowelzel.de> - 2013-07-09 17:20 +0200
              Re: cURL and response code 302 bill <william@TechServSys.com> - 2013-07-10 10:40 -0400
              Re: cURL and response code 302 bill <william@TechServSys.com> - 2013-07-10 11:09 -0400
                Re: cURL and response code 302 Arno Welzel <usenet@arnowelzel.de> - 2013-07-11 00:12 +0200
                  Re: cURL and response code 302 bill <william@TechServSys.com> - 2013-07-11 10:51 -0400
                    Re: cURL and response code 302 Arno Welzel <usenet@arnowelzel.de> - 2013-07-11 21:04 +0200
                      Re: cURL and response code 302 bill <william@TechServSys.com> - 2013-07-12 09:58 -0400
            Re: cURL and response code 302 Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-07-09 21:44 -0700
              Re: cURL and response code 302 bill <william@TechServSys.com> - 2013-07-10 10:42 -0400
                Re: cURL and response code 302 Scott Johnson <noonehome@chalupasworld.com> - 2013-07-10 16:13 -0700
                  Re: cURL and response code 302 bill <william@TechServSys.com> - 2013-07-12 09:59 -0400
              Re: cURL and response code 302 kyrpog83@gmail.com - 2014-04-10 10:23 -0700

#10041 — cURL and response code 302

Frombill <william@TechServSys.com>
Date2013-07-08 11:35 -0400
SubjectcURL and response code 302
Message-ID<krem8f$epd$1@speranza.aioe.org>
when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
I am getting a 302, moved temporarily.

How do I find out the URL it is being redirected to ?
The effectiveURL that is returned is the one I sent the request to.

bill

[toc] | [next] | [standalone]


#10042

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2013-07-08 09:02 -0700
Message-ID<uoBCt.963$t_.539@newsfe11.iad>
In reply to#10041
On 7/8/13 8:35 AM, bill wrote:
> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
> I am getting a 302, moved temporarily.
>
> How do I find out the URL it is being redirected to ?
> The effectiveURL that is returned is the one I sent the request to.
>
> bill

The "Location" response header contains the desired URL.

See:
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>

[toc] | [prev] | [next] | [standalone]


#10048

Frombill <william@TechServSys.com>
Date2013-07-09 10:09 -0400
Message-ID<krh5it$s6a$1@speranza.aioe.org>
In reply to#10042
On 7/8/2013 12:02 PM, Daniel Pitts wrote:
> On 7/8/13 8:35 AM, bill wrote:
>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
>> I am getting a 302, moved temporarily.
>>
>> How do I find out the URL it is being redirected to ?
>> The effectiveURL that is returned is the one I sent the request
>> to.
>>
>> bill
>
> The "Location" response header contains the desired URL.
>
> See:
> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>

Thanks, is there a way to obtain the Location response header 
from cURL ?

bill

[toc] | [prev] | [next] | [standalone]


#10051

FromArno Welzel <usenet@arnowelzel.de>
Date2013-07-09 16:24 +0200
Message-ID<51DC1D1D.3090905@arnowelzel.de>
In reply to#10048
Am 09.07.2013 16:09, schrieb bill:

> On 7/8/2013 12:02 PM, Daniel Pitts wrote:
>> On 7/8/13 8:35 AM, bill wrote:
>>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
>>> I am getting a 302, moved temporarily.
>>>
>>> How do I find out the URL it is being redirected to ?
>>> The effectiveURL that is returned is the one I sent the request
>>> to.
>>>
>>> bill
>>
>> The "Location" response header contains the desired URL.
>>
>> See:
>> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>
> 
> Thanks, is there a way to obtain the Location response header 
> from cURL ?

Maybe this example in the documentation may help:

<http://www.php.net/manual/en/function.curl-exec.php#80442>



-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [next] | [standalone]


#10052

Frombill <william@TechServSys.com>
Date2013-07-09 10:51 -0400
Message-ID<krh82d$4hl$1@speranza.aioe.org>
In reply to#10051
On 7/9/2013 10:24 AM, Arno Welzel wrote:
> Am 09.07.2013 16:09, schrieb bill:
>
>> On 7/8/2013 12:02 PM, Daniel Pitts wrote:
>>> On 7/8/13 8:35 AM, bill wrote:
>>>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
>>>> I am getting a 302, moved temporarily.
>>>>
>>>> How do I find out the URL it is being redirected to ?
>>>> The effectiveURL that is returned is the one I sent the request
>>>> to.
>>>>
>>>> bill
>>>
>>> The "Location" response header contains the desired URL.
>>>
>>> See:
>>> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>
>>
>> Thanks, is there a way to obtain the Location response header
>> from cURL ?
>
> Maybe this example in the documentation may help:
>
> <http://www.php.net/manual/en/function.curl-exec.php#80442>
>
>
>
actually, suggesting that I look at curlopt_header would have 
been more clear.

bill

[toc] | [prev] | [next] | [standalone]


#10053

FromArno Welzel <usenet@arnowelzel.de>
Date2013-07-09 17:20 +0200
Message-ID<51DC2A36.7090005@arnowelzel.de>
In reply to#10052
Am 09.07.2013 16:51, schrieb bill:
> On 7/9/2013 10:24 AM, Arno Welzel wrote:
>> Am 09.07.2013 16:09, schrieb bill:
>>
>>> On 7/8/2013 12:02 PM, Daniel Pitts wrote:
>>>> On 7/8/13 8:35 AM, bill wrote:
>>>>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
>>>>> I am getting a 302, moved temporarily.
>>>>>
>>>>> How do I find out the URL it is being redirected to ?
>>>>> The effectiveURL that is returned is the one I sent the request
>>>>> to.
>>>>>
>>>>> bill
>>>>
>>>> The "Location" response header contains the desired URL.
>>>>
>>>> See:
>>>> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>
>>>
>>> Thanks, is there a way to obtain the Location response header
>>> from cURL ?
>>
>> Maybe this example in the documentation may help:
>>
>> <http://www.php.net/manual/en/function.curl-exec.php#80442>
>>
>>
>>
> actually, suggesting that I look at curlopt_header would have 
> been more clear.

Maybe - but since it is also neccessary to check the header size to
separate the header from the body I refered to the example. And finally
you got the right hint - didn't you? ;-)


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [next] | [standalone]


#10058

Frombill <william@TechServSys.com>
Date2013-07-10 10:40 -0400
Message-ID<krjro2$s38$1@speranza.aioe.org>
In reply to#10053
On 7/9/2013 11:20 AM, Arno Welzel wrote:
> Am 09.07.2013 16:51, schrieb bill:
>> On 7/9/2013 10:24 AM, Arno Welzel wrote:
>>> Am 09.07.2013 16:09, schrieb bill:
>>>
>>>> On 7/8/2013 12:02 PM, Daniel Pitts wrote:
>>>>> On 7/8/13 8:35 AM, bill wrote:
>>>>>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
>>>>>> I am getting a 302, moved temporarily.
>>>>>>
>>>>>> How do I find out the URL it is being redirected to ?
>>>>>> The effectiveURL that is returned is the one I sent the request
>>>>>> to.
>>>>>>
>>>>>> bill
>>>>>
>>>>> The "Location" response header contains the desired URL.
>>>>>
>>>>> See:
>>>>> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>
>>>>
>>>> Thanks, is there a way to obtain the Location response header
>>>> from cURL ?
>>>
>>> Maybe this example in the documentation may help:
>>>
>>> <http://www.php.net/manual/en/function.curl-exec.php#80442>
>>>
>>>
>>>
>> actually, suggesting that I look at curlopt_header would have
>> been more clear.
>
> Maybe - but since it is also neccessary to check the header size to
> separate the header from the body I refered to the example. And finally
> you got the right hint - didn't you? ;-)
>

I don't know if I got it or not.  Perhaps you could be a bit more 
clear ?
bill

[toc] | [prev] | [next] | [standalone]


#10060

Frombill <william@TechServSys.com>
Date2013-07-10 11:09 -0400
Message-ID<krjtg7$1j1$1@speranza.aioe.org>
In reply to#10053
On 7/9/2013 11:20 AM, Arno Welzel wrote:
> Am 09.07.2013 16:51, schrieb bill:
>> On 7/9/2013 10:24 AM, Arno Welzel wrote:
>>> Am 09.07.2013 16:09, schrieb bill:
>>>
>>>> On 7/8/2013 12:02 PM, Daniel Pitts wrote:
>>>>> On 7/8/13 8:35 AM, bill wrote:
>>>>>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
>>>>>> I am getting a 302, moved temporarily.
>>>>>>
>>>>>> How do I find out the URL it is being redirected to ?
>>>>>> The effectiveURL that is returned is the one I sent the request
>>>>>> to.
>>>>>>
>>>>>> bill
>>>>>
>>>>> The "Location" response header contains the desired URL.
>>>>>
>>>>> See:
>>>>> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>
>>>>
>>>> Thanks, is there a way to obtain the Location response header
>>>> from cURL ?
>>>
>>> Maybe this example in the documentation may help:
>>>
>>> <http://www.php.net/manual/en/function.curl-exec.php#80442>
>>>
>>>
>>>
>> actually, suggesting that I look at curlopt_header would have
>> been more clear.
>
> Maybe - but since it is also neccessary to check the header size to
> separate the header from the body I refered to the example. And finally
> you got the right hint - didn't you? ;-)

using:

function curl_getNoFollow($url, array $get = NULL, array $options 
= array() ){
     $defaults = array(
         CURLOPT_HEADER => 0,
         CURLOPT_RETURNTRANSFER => TRUE,
         CURLOPT_FORBID_REUSE => 1,
         CURLOPT_TIMEOUT => 30,
		CURLOPT_SSL_VERIFYPEER =>0,
		CURLOPT_COOKIEFILE => '/tmp/cookies.txt',
		CURLOPT_COOKIEJAR=> '/tmp/cookies.txt',
		CURLOPT_HEADER 	=>TRUE,
		CURLINFO_HEADER_OUT => TRUE,
		CURLOPT_FOLLOWLOCATION	=>FALSE,
		CURLOPT_USERAGENT =>'Mosilla/5.0(Windows NT 6.1,;WOW64,rv21.0) 
Gecko/20100101 Firefox/21.0)',
		);
$ch = curl_init();
curl_setopt ($ch,CURLOPT_URL,  $url);
curl_setopt_array($ch, ($options + $defaults));

$result = curl_exec($ch);

$eurl = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);
$http =curl_getinfo($ch,CURLINFO_HTTP_CODE);

$resultx =array($result,  $eurl, $http,); //  result is an 
array($result, $eurl, $http)
     curl_close($ch);
	
    return $resultx;
}

I get:
url: http://www.mydomain.com/login/login.cfm, http: 302

note the lack of information about the refer to address, which I 
need so I can follow.

[toc] | [prev] | [next] | [standalone]


#10063

FromArno Welzel <usenet@arnowelzel.de>
Date2013-07-11 00:12 +0200
Message-ID<51DDDC3D.9010609@arnowelzel.de>
In reply to#10060
bill, 2013-07-10 17:09:

[...]
> using:
> 
> function curl_getNoFollow($url, array $get = NULL, array $options 
> = array() ){
[...]
> I get:
> url: http://www.mydomain.com/login/login.cfm, http: 302
> 
> note the lack of information about the refer to address, which I 
> need so I can follow.

A quick & dirty example without any error handling etc. - just to get
the idea:

<?php
$options = array(
	CURLOPT_URL => 'http://mydomain.example/foobar',
	CURLOPT_HEADER => true,
	CURLOPT_FOLLOWLOCATION => false,
	CURLOPT_RETURNTRANSFER => true
);

$ch = curl_init();
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
$resultcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);

if($resultcode == 302)
	$redirect = curl_getinfo($ch, CURLINFO_REDIRECT_URL);
else
	$redirect = '';

echo 'Effective URL: '.$url.'<br/>';
echo 'HTTP result code: '.$resultcode.'<br/>';
echo 'Redirection: '.$redirect.'<br/>';

curl_close($ch);
?>

See in action at <http://arnowelzel.de/samples/curl-sample.php>

CURLINFO_REDIRECT_URL is not in the documentation but it was added in
PHP 5.3.7. Also see <http://php.net/ChangeLog-5.php>.

If this does not work for you (e.g. because you have an older PHP
version), you have to extract the location header "manually".

HTH


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [next] | [standalone]


#10065

Frombill <william@TechServSys.com>
Date2013-07-11 10:51 -0400
Message-ID<krmgp9$jl6$1@speranza.aioe.org>
In reply to#10063
On 7/10/2013 6:12 PM, Arno Welzel wrote:

> if($resultcode == 302)
> 	$redirect = curl_getinfo($ch, CURLINFO_REDIRECT_URL);
> else
> 	$redirect = '';
>
> echo 'Effective URL: '.$url.'<br/>';
> echo 'HTTP result code: '.$resultcode.'<br/>';
> echo 'Redirection: '.$redirect.'<br/>';
>
> curl_close($ch);
> ?>
>
> See in action at <http://arnowelzel.de/samples/curl-sample.php>
>
> CURLINFO_REDIRECT_URL is not in the documentation but it was added in
> PHP 5.3.7. Also see <http://php.net/ChangeLog-5.php>.
>
> If this does not work for you (e.g. because you have an older PHP
> version), you have to extract the location header "manually".

that helps.  The php I have available is 5.3, so hints at 
extracting it "manually?"

With thanks and appreciation.

bill

[toc] | [prev] | [next] | [standalone]


#10066

FromArno Welzel <usenet@arnowelzel.de>
Date2013-07-11 21:04 +0200
Message-ID<51DF01D9.9060502@arnowelzel.de>
In reply to#10065
bill, 2013-07-11 16:51:

> On 7/10/2013 6:12 PM, Arno Welzel wrote:
> 
>> if($resultcode == 302)
>> 	$redirect = curl_getinfo($ch, CURLINFO_REDIRECT_URL);
>> else
>> 	$redirect = '';
>>
>> echo 'Effective URL: '.$url.'<br/>';
>> echo 'HTTP result code: '.$resultcode.'<br/>';
>> echo 'Redirection: '.$redirect.'<br/>';
>>
>> curl_close($ch);
>> ?>
>>
>> See in action at <http://arnowelzel.de/samples/curl-sample.php>
>>
>> CURLINFO_REDIRECT_URL is not in the documentation but it was added in
>> PHP 5.3.7. Also see <http://php.net/ChangeLog-5.php>.
>>
>> If this does not work for you (e.g. because you have an older PHP
>> version), you have to extract the location header "manually".
> 
> that helps.  The php I have available is 5.3, so hints at 
> extracting it "manually?"
> 
> With thanks and appreciation.

In the example above you will get the headers in $result.

With curl_getinfo(CURLINFO_HEADER_SIZE) you can also check how long the
header part in $result is (beginning with the first character), so

$headers = substr($result, curl_getinfo(CURLINFO_HEADER_SIZE));

should give you all headers.

HTTP headers are in the form

Header1: Value
Header2: Value
[...]

And the redirection URL is

Location: URL

So try to find the "Location: " part and use the remaining text up to
the line break.

BTW: Using tools like the Firebug AddOn for Firefox help a lot to
understand HTTP headers.


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [next] | [standalone]


#10067

Frombill <william@TechServSys.com>
Date2013-07-12 09:58 -0400
Message-ID<krp226$4it$1@speranza.aioe.org>
In reply to#10066
On 7/11/2013 3:04 PM, Arno Welzel wrote:
> bill, 2013-07-11 16:51:
>
>> On 7/10/2013 6:12 PM, Arno Welzel wrote:
>>
>>> if($resultcode == 302)
>>> 	$redirect = curl_getinfo($ch, CURLINFO_REDIRECT_URL);
>>> else
>>> 	$redirect = '';
>>>
>>> echo 'Effective URL: '.$url.'<br/>';
>>> echo 'HTTP result code: '.$resultcode.'<br/>';
>>> echo 'Redirection: '.$redirect.'<br/>';
>>>
>>> curl_close($ch);
>>> ?>
>>>
>>> See in action at <http://arnowelzel.de/samples/curl-sample.php>
>>>
>>> CURLINFO_REDIRECT_URL is not in the documentation but it was added in
>>> PHP 5.3.7. Also see <http://php.net/ChangeLog-5.php>.
>>>
>>> If this does not work for you (e.g. because you have an older PHP
>>> version), you have to extract the location header "manually".
>>
>> that helps.  The php I have available is 5.3, so hints at
>> extracting it "manually?"
>>
>> With thanks and appreciation.
>
> In the example above you will get the headers in $result.
>
> With curl_getinfo(CURLINFO_HEADER_SIZE) you can also check how long the
> header part in $result is (beginning with the first character), so
>
> $headers = substr($result, curl_getinfo(CURLINFO_HEADER_SIZE));
>
> should give you all headers.
>
> HTTP headers are in the form
>
> Header1: Value
> Header2: Value
> [...]
>
> And the redirection URL is
>
> Location: URL
>
> So try to find the "Location: " part and use the remaining text up to
> the line break.
>
> BTW: Using tools like the Firebug AddOn for Firefox help a lot to
> understand HTTP headers.
>
>
Thanks much.  Yes I do use Firebug and it is helpful.  Just can't 
use it with cURL.

I am going to try to upgrade to php5 version 5.4 later today.

Again, thanks for the help.

bill

[toc] | [prev] | [next] | [standalone]


#10057

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2013-07-09 21:44 -0700
Message-ID<lE5Dt.41228$T55.1895@fx16.iad>
In reply to#10052
On 7/9/13 7:51 AM, bill wrote:
> On 7/9/2013 10:24 AM, Arno Welzel wrote:
>> Am 09.07.2013 16:09, schrieb bill:
>>
>>> On 7/8/2013 12:02 PM, Daniel Pitts wrote:
>>>> On 7/8/13 8:35 AM, bill wrote:
>>>>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
>>>>> I am getting a 302, moved temporarily.
>>>>>
>>>>> How do I find out the URL it is being redirected to ?
>>>>> The effectiveURL that is returned is the one I sent the request
>>>>> to.
>>>>>
>>>>> bill
>>>>
>>>> The "Location" response header contains the desired URL.
>>>>
>>>> See:
>>>> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>
>>>
>>> Thanks, is there a way to obtain the Location response header
>>> from cURL ?
>>
>> Maybe this example in the documentation may help:
>>
>> <http://www.php.net/manual/en/function.curl-exec.php#80442>
>>
>>
>>
> actually, suggesting that I look at curlopt_header would have been more
> clear.
>
> bill

Actually, suggesting that you RTFM yourself would have been most clear. 
I understand not knowing about Location and HTTP spec, and not knowing 
where to look for that.  You should learn how to find things in 
libraries that you're using though.

[toc] | [prev] | [next] | [standalone]


#10059

Frombill <william@TechServSys.com>
Date2013-07-10 10:42 -0400
Message-ID<krjrsl$s38$2@speranza.aioe.org>
In reply to#10057
On 7/10/2013 12:44 AM, Daniel Pitts wrote:
> On 7/9/13 7:51 AM, bill wrote:
>> On 7/9/2013 10:24 AM, Arno Welzel wrote:
>>> Am 09.07.2013 16:09, schrieb bill:
>>>
>>>> On 7/8/2013 12:02 PM, Daniel Pitts wrote:
>>>>> On 7/8/13 8:35 AM, bill wrote:
>>>>>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
>>>>>> I am getting a 302, moved temporarily.
>>>>>>
>>>>>> How do I find out the URL it is being redirected to ?
>>>>>> The effectiveURL that is returned is the one I sent the
>>>>>> request
>>>>>> to.
>>>>>>
>>>>>> bill
>>>>>
>>>>> The "Location" response header contains the desired URL.
>>>>>
>>>>> See:
>>>>> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>
>>>>>
>>>>
>>>> Thanks, is there a way to obtain the Location response header
>>>> from cURL ?
>>>
>>> Maybe this example in the documentation may help:
>>>
>>> <http://www.php.net/manual/en/function.curl-exec.php#80442>
>>>
>>>
>>>
>> actually, suggesting that I look at curlopt_header would have
>> been more
>> clear.
>>
>> bill
>
> Actually, suggesting that you RTFM yourself would have been most
> clear. I understand not knowing about Location and HTTP spec, and
> not knowing where to look for that.  You should learn how to find
> things in libraries that you're using though.

Actually, I not only read the manual, I studied it (and the 
coments) and still missed curlopt_header.... (as usual) until I 
had sent my first message.

Sometimes when you are new to an area it is hard to 
find/understand the fine print.

bill

[toc] | [prev] | [next] | [standalone]


#10064

FromScott Johnson <noonehome@chalupasworld.com>
Date2013-07-10 16:13 -0700
Message-ID<krkpgf$j1j$1@dont-email.me>
In reply to#10059
On 7/10/2013 7:42 AM, bill wrote:
> On 7/10/2013 12:44 AM, Daniel Pitts wrote:
>> On 7/9/13 7:51 AM, bill wrote:
>>> On 7/9/2013 10:24 AM, Arno Welzel wrote:
>>>> Am 09.07.2013 16:09, schrieb bill:
>>>>
>>>>> On 7/8/2013 12:02 PM, Daniel Pitts wrote:
>>>>>> On 7/8/13 8:35 AM, bill wrote:
>>>>>>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
>>>>>>> I am getting a 302, moved temporarily.
>>>>>>>
>>>>>>> How do I find out the URL it is being redirected to ?
>>>>>>> The effectiveURL that is returned is the one I sent the
>>>>>>> request
>>>>>>> to.
>>>>>>>
>>>>>>> bill
>>>>>>
>>>>>> The "Location" response header contains the desired URL.
>>>>>>
>>>>>> See:
>>>>>> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>
>>>>>>
>>>>>
>>>>> Thanks, is there a way to obtain the Location response header
>>>>> from cURL ?
>>>>
>>>> Maybe this example in the documentation may help:
>>>>
>>>> <http://www.php.net/manual/en/function.curl-exec.php#80442>
>>>>
>>>>
>>>>
>>> actually, suggesting that I look at curlopt_header would have
>>> been more
>>> clear.
>>>
>>> bill
>>
>> Actually, suggesting that you RTFM yourself would have been most
>> clear. I understand not knowing about Location and HTTP spec, and
>> not knowing where to look for that.  You should learn how to find
>> things in libraries that you're using though.
>
> Actually, I not only read the manual, I studied it (and the coments) and
> still missed curlopt_header.... (as usual) until I had sent my first
> message.
>
> Sometimes when you are new to an area it is hard to find/understand the
> fine print.
>
> bill
>
>
I like to think of the premise that if you don't know what you don't 
know, you don't know what there is to know.

Scotty

[toc] | [prev] | [next] | [standalone]


#10068

Frombill <william@TechServSys.com>
Date2013-07-12 09:59 -0400
Message-ID<krp24e$4it$3@speranza.aioe.org>
In reply to#10064
On 7/10/2013 7:13 PM, Scott Johnson wrote:

>>
>>
> I like to think of the premise that if you don't know what you
> don't know, you don't know what there is to know.
>
> Scotty

exactly  and it is even harder when the doc's are not quite up to 
date.

bill

[toc] | [prev] | [next] | [standalone]


#13377

Fromkyrpog83@gmail.com
Date2014-04-10 10:23 -0700
Message-ID<451f635c-7266-4597-b0ae-8ec2f5583151@googlegroups.com>
In reply to#10057
asshole


On Wednesday, July 10, 2013 12:44:02 AM UTC-4, Daniel Pitts wrote:
> On 7/9/13 7:51 AM, bill wrote:
> 
> > On 7/9/2013 10:24 AM, Arno Welzel wrote:
> 
> >> Am 09.07.2013 16:09, schrieb bill:
> 
> >>
> 
> >>> On 7/8/2013 12:02 PM, Daniel Pitts wrote:
> 
> >>>> On 7/8/13 8:35 AM, bill wrote:
> 
> >>>>> when I have cUrl seet up with CURLOPT_FOLLOWLOCATION =>FALSE,
> 
> >>>>> I am getting a 302, moved temporarily.
> 
> >>>>>
> 
> >>>>> How do I find out the URL it is being redirected to ?
> 
> >>>>> The effectiveURL that is returned is the one I sent the request
> 
> >>>>> to.
> 
> >>>>>
> 
> >>>>> bill
> 
> >>>>
> 
> >>>> The "Location" response header contains the desired URL.
> 
> >>>>
> 
> >>>> See:
> 
> >>>> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3>
> 
> >>>
> 
> >>> Thanks, is there a way to obtain the Location response header
> 
> >>> from cURL ?
> 
> >>
> 
> >> Maybe this example in the documentation may help:
> 
> >>
> 
> >> <http://www.php.net/manual/en/function.curl-exec.php#80442>
> 
> >>
> 
> >>
> 
> >>
> 
> > actually, suggesting that I look at curlopt_header would have been more
> 
> > clear.
> 
> >
> 
> > bill
> 
> 
> 
> Actually, suggesting that you RTFM yourself would have been most clear. 
> 
> I understand not knowing about Location and HTTP spec, and not knowing 
> 
> where to look for that.  You should learn how to find things in 
> 
> libraries that you're using though.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web