PHP Classes

302 Moved Temporarily

Recommend this page to a friend!

      PHP HTTP protocol client  >  All threads  >  302 Moved Temporarily  >  (Un) Subscribe thread alerts  
Subject:302 Moved Temporarily
Summary:Can't get the response of GET
Messages:4
Author:Matheus Gorino
Date:2005-03-14 16:46:26
Update:2005-03-15 16:32:57
 

  1. 302 Moved Temporarily   Reply   Report abuse  
Picture of Matheus Gorino Matheus Gorino - 2005-03-14 16:46:26
I'm needing to use the class to do the following actions:
- Login into a Basic HTTP Auth;
- Login into a authentication form;
- Get the response of the redirected page;

To this, I'm using the following URL:
$authentication = 'xxxx:xxxx@';
$url="https://".$authentication."myserver.com.br:8080/auth/logon.do?username=myusername&password=mypass&uredir=https://myserver.com.br:8080/adm/onManReport.do";

The point is that it is returning the following error:
Error: authentication error: 302 Moved Temporarily

Any suggestions?

Thank you!
Matheus.

  2. Re: 302 Moved Temporarily   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2005-03-14 18:47:16 - In reply to message 1 from Matheus Gorino
As explained in the test_http.php example script, just set the follow_redirect class variable to 1:

$http->follow_redirect=1;

  3. Re: 302 Moved Temporarily   Reply   Report abuse  
Picture of Matheus Gorino Matheus Gorino - 2005-03-15 12:23:36 - In reply to message 2 from Manuel Lemos
I've already did it:

require("includes/http/http.php");
require("includes/http/sasl.php");

set_time_limit(0);
$http=new http_class;
$http->timeout=0;
$http->data_timeout=0;
$http->debug=1;
$http->html_debug=1;
$http->follow_redirect=1;
$http->redirection_limit=50;
$http->exclude_address="";
$http->protocol_version="1.0";
$http->force_multipart_form_post=0;

$user="xxxx";
$password="xxxx";

$authentication=(strlen($user) ? UrlEncode($user).":".UrlEncode($password)."@" : "");

$url="https://".$authentication."dominio.com.br:8080/auth/logon.do?username=root&password=root&uredir=https://dominio.com.br:8080/adm/onManReport.do";

  4. Re: 302 Moved Temporarily   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2005-03-15 16:32:57 - In reply to message 3 from Matheus Gorino
Possibly the site is looping back and forth redirecting to the same pages and when it exceeds the number of redirects the class gives up to not be stuck in an infinite loop. I would have to see your script and the site that you are trying to access to figure what is the problem.