
StalkR GHOST - 2008-01-25 22:14:55
Hello,
First, a *huge* thank you for this powerful class. I'm using it a lot in my web spiders, parsers, robots...
Second, I was using the good $follow_redirect feature but I was disappointed: I couldn't retrieve the URL of the page where I was finally redirected at the end.
This small suggestion adds an extra server header, to know where we go...
---[ OPEN ]--- // the main class
http.php
---[ FIND ]--- // approx. line 1318
if(strlen($error=$this->Close())==0
&& strlen($error=$this->Open($arguments))==0
&& strlen($error=$this->SendRequest($arguments))==0)
{
$this->redirection_level++;
if($this->redirection_level>$this->redirection_limit)
$error="it was exceeded the limit of request redirections";
else
$error=$this->ReadReplyHeaders($headers);
$this->redirection_level--;
}
if(strlen($error))
return($this->SetError($error));
---[ ADD AFTER ]--- // approx. line 1331
$headers['http_lib__redirected_to'] = $location;
--[ SAVE AND CLOSE ]---
Obviously, the header key must be recognizable enough because you don't want to parse it as a *server* header ;)
Anyway, this was just to tell you about the idea I got (because I needed it, of course ^^).
Another interesting thing could be to add a kind of "URL route" to know where the request has passed before arriving.
Once again, well done with this class!
Best regards,
StalkR.