Re: emulate a browser

From: Date: Thu, 24 Jan 2002 13:24:47 +0000
Subject: Re: emulate a browser
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-81870@lists.php.net to get a copy of this message
At 10:33 AM 1/24/2002 +0100, Frank Benady wrote:
It works really nice, Michael, thanks again. I have one more question, maybe you can answer me : If the domain name has been redirected with hte permanent redirect, I get the 301 Moved Permanently header response. But if the domain name has been frame-forwarded, I have no header response. Is it normal ? Do you know if there is some alternatives so I could check if the domain name is used, even on a frame-forward type redirectection ? Moreover, if the domain has been redirected, is it possible to get the url it has been redirected to ?
I'm not really sure what you mean by frame-forwarded. The only methods of redirection that I'm really familiar with are: 1. An HTTP header redirect, such as "Location: http://somewhere" 2. A refresh meta tag in the actual body of the document, such as: <meta http-equiv="Refresh" content="0;URL=http://somewhere"> 3. A javascript redirect like so: <body onload="javascript:window.location.href = 'http://somewhere'"> I'm sure there are many other methods but those are the only three that I am personally familiar with. Number 1 is easy to figure out by simply parsing the HTTP header that is returned to you from the remote server. Numbers 2 and 3 are trickier, because you actually have to read the page in and parse it. I'd probably do so using a regex to try and determine if these redirect methods exist and where they are going if so. Number 3 is further complicated by the possibility of the redirect being wrapped up inside a JavaScript function so that makes it even harder to find using a regex. Maybe someone else reading this can give you some more/better information...

« previous php.general (#81870) next »