0
Use the curl
to capture data from a page, but is returning the code 301
(moved). I used CURLOPT_FOLLOWLOCATION
, but it’s still the same. Someone knows how to track redirect?
0
Use the curl
to capture data from a page, but is returning the code 301
(moved). I used CURLOPT_FOLLOWLOCATION
, but it’s still the same. Someone knows how to track redirect?
0
Usually a setup like this is enough
// Inicia o cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 5); // tempo em segundos
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // em segundos
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // true: permite redirecionamento
curl_setopt($ch, CURLOPT_MAXREDIRS, 1); // quantidade limite de redirecionamentos permitidos
//daqui em diante você define e outros parâmetros, etc.
See also: /a/123883/4793
-2
I don’t usually know if you’re already doing this use the -L option to track the redirect. Otherwise access the address by the browser and after the redirect replace the URL with the new one.
curl -L <URL>
Probably negative because the question is related to PHP, your answer is to Curl in the command line.
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
Post the code of how you tried.
– Celso Marigo Jr
and the Curl link
– Jasar Orion
You can also find the answer at http://answall.com/q/71275/3635 and http://answall.com/a/126095/3635
– Guilherme Nascimento