Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

222
Visualizações
Login to website and get the redirected url content with PHP

I am trying to get the content (text) from a website where I am a member, I found a plenty of examples of how to do this using cURL to login and get the context, however I am not sure how to handle with the redirection after I get log into the website. The result that I got from the code below is the login form (Example #1 here). I am wondering if I have no access is this really possible to do?

$postdata = http_build_query(
    array(
    'Account' => 'myaccount',
    'Password' => 'mypass'
    )
 );

$opts = array('http' =>
        array(
         'method'  => 'POST',
         'header'  => 'Content-type: application/x-www-form-urlencoded',
         'content' => $postdata
    )
  );

$context  = stream_context_create($opts);

$result = file_get_contents('http://www.website.php/login.php', false, 
$context);

After the login successful what I expect is to get the text from the redirected url which looks like http://www.website.php/other.php

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda