FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » cURL and response code 302
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
cURL and response code 302 [message #182089] Mon, 08 July 2013 15:35 Go to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182090 is a reply to message #182089] Mon, 08 July 2013 16:02 Go to previous messageGo to next message
Daniel Pitts is currently offline  Daniel Pitts
Messages: 68
Registered: May 2012
Karma: 0
Member
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>
Re: cURL and response code 302 [message #182096 is a reply to message #182090] Tue, 09 July 2013 14:09 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182099 is a reply to message #182096] Tue, 09 July 2013 14:24 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182100 is a reply to message #182099] Tue, 09 July 2013 14:51 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182101 is a reply to message #182100] Tue, 09 July 2013 15:20 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182105 is a reply to message #182100] Wed, 10 July 2013 04:44 Go to previous messageGo to next message
Daniel Pitts is currently offline  Daniel Pitts
Messages: 68
Registered: May 2012
Karma: 0
Member
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.
Re: cURL and response code 302 [message #182106 is a reply to message #182101] Wed, 10 July 2013 14:40 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182107 is a reply to message #182105] Wed, 10 July 2013 14:42 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182108 is a reply to message #182101] Wed, 10 July 2013 15:09 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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.
Re: cURL and response code 302 [message #182111 is a reply to message #182108] Wed, 10 July 2013 22:12 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182112 is a reply to message #182107] Wed, 10 July 2013 23:13 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182113 is a reply to message #182111] Thu, 11 July 2013 14:51 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182114 is a reply to message #182113] Thu, 11 July 2013 19:04 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182115 is a reply to message #182114] Fri, 12 July 2013 13:58 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #182116 is a reply to message #182112] Fri, 12 July 2013 13:59 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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
Re: cURL and response code 302 [message #185548 is a reply to message #182105] Thu, 10 April 2014 17:23 Go to previous message
kyrpog83 is currently offline  kyrpog83
Messages: 1
Registered: April 2014
Karma: 0
Junior Member
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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Install Apache Php Windows 64 bit
Next Topic: Heartbleed bug?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 12:06:48 GMT 2024

Total time taken to generate the page: 0.06989 seconds