If it is frame forwarded, you would get a 300 OK status becuase you have
accessed a web page and it has been server OK. The webpage (which contains
the <FRAMESET> tags) then send a request to another server to get the page
to be redirected to.
The only way to check for this would be to see if the page you have sent the
request for contains the <FRAMESET> tags (use GET instead of HEAD) but this
would be unreliable as a lot of websites start with a frame based page
anyway.

LJ

"Frank Benady" <[EMAIL PROTECTED]> wrote in message
004301c1a4ba$478a41c0$01000001@phoenix">news:004301c1a4ba$478a41c0$01000001@phoenix...
> 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 ?
>
> Thanks again for your help
>
> Frank
>
> ----- Original Message -----
> From: "Michael Sims" <[EMAIL PROTECTED]>
> To: "Frank Benady" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Thursday, January 24, 2002 2:28 AM
> Subject: Re: [PHP] emulate a browser
>
>
> > At 01:45 AM 1/24/2002 +0100, Frank Benady wrote:
> > >Hi All
> > >
> > >Can I emulate the first request of a browser when it tries to connect
> to a
> > >distant server using a domain name and parse the answer from the
> remote
> > >server to know if there is a website located there or if there is no
> hosting
> > >(or even some kind of forwarding) configured for this domain name ?
> > >Is ther some http functions in PHP which permit to do this test ?
> >
> > You can use fsockopen() to open a socket connection to a remote host
> via
> > port 80 (HTTP).  If fsockopen() returns a valid file pointer then that
> > means there is something listening on port 80 on the host (99% it will
> be a
> > web server).
> >
> > You could then use fputs() to send a request to the server, such as:
> >
> > "HEAD / HTTP/1.0\r\n\r\n"
> >
> > Normally browsers use GET instead of HEAD, but in your case you are
> only
> > interested in the servers response (the HTTP headers) and not the
> actual
> > file/page itself.
> >
> > You could then use fgets() to read the response sent back from the
> server
> > and parse it to get the information you wanted (for example, look for
> a
> > "Location: ..." line in the headers to see if the page is trying to
> > redirect the browser).
> >
> > I have a function that checks to see if a particular file is available
> via
> > HTTP from a remote host.  It takes a full URL and returns true if the
> > page/file exists, and false if it doesn't.  With some work you could
> modify
> > this script to achieve what you want.  I'm posting it below.  Ask if
> you
> > have any questions about it.
> >
> > Oh, BTW, I'm sure that I have (as usually) went totally overboard with
> this
> > function and someone will now probably point out that PHP has
> something
> > built in to do what I'm doing here...but I couldn't find it and I had
> fun
> > writing this function anyway. :-)
> >
> > <?
> > function http_file_exists ($url) {
> >
> >    if (!preg_match("/^http:\/\/([^\/]+)\/.*$/i",$url,$matches)) {
> >
> >      return "Error - incorrect format";
> >
> >    } else {
> >
> >      $host = $matches[1];
> >      $fp = fsockopen ($host, 80, $errno, $errstr, 30);
> >      if (!$fp) return "Error - couldn't connect to host";
> >        else {
> >          fputs ($fp, "HEAD $url HTTP/1.0\r\n\r\n");
> >          $response = fgets ($fp,128);
> >          fclose ($fp);
> >          return (eregi("^.+200 OK.+$",$response) ? true : false);
> >        }
> >
> >    }
> > }
> > ?>
> >
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to