NYCPHP Meetup

NYPHP.org

[nycphp-talk] fopen have a "setTimeout" feature?

Phil Powell soazine at erols.com
Mon Dec 9 02:06:08 EST 2002


Nice solution, but sadly, I can't use it, because the script I need to fopen
is not the default script on the host domain's docroot:

<?
  $fp = fsockopen("www3.brinkster.com/soa/val/profile/display.asp", 80);
  if(!$fp) {
   echo "Unable to open\
";
  } else {
   fputs($fp, "GET / HTTP/1.0\
\
");
   $start = time();
   socket_set_timeout($fp, 5);
   $res = fread($fp, 1000000);
   var_dump(socket_get_status($fp));
   fclose($fp);
   echo $res;
  }

?>

This will never open.  :(

Phil
----- Original Message -----
From: "Oktay Altunergil" <nyphp at altunergil.com>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Sunday, December 08, 2002 3:07 PM
Subject: Re: [nycphp-talk] fopen have a "setTimeout" feature?


> Might this be what you're looking for?
>
> http://www.php.net/manual/en/function.stream-set-timeout.php
>
> oktay
>
> On Sun, 08 Dec 2002 14:35:09 -0500
> Phil Powell <soazine at erols.com> wrote:
>
> > Can you set something like a "setTimeout" feature in fopen? That is, if
you use fopen to open a URL for "scraping", if that URL's server is down or
doesn't respond in x seconds, can you set a feature to show an error message
or a "friendly" error message indicating such?
> >
> > Thanx
> > Phil
> >
> >
> >
> >
> >
> >
>
>
> --- Unsubscribe at http://nyphp.org/list/ ---
>
>




More information about the talk mailing list