try @fopen(...)
prepending a '@' to the mysql funcs will suppress error
messages by those functions... maybe it'll work for fopen also.
never tried it, though.
> -----Original Message-----
> From: Kenneth R Zink II [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 15, 2001 4:58 PM
> To: PHP
> Subject: Re: [PHP] fopen to validate a URL
>
>
> Well I changed the code to this expecting a true or false response (1 or 0)
>
> $url=$row[url];
> echo "Old URL = ".$url."<br>";
>
> $fp = fopen("$url","r");
>
> echo "fp = ".$fp."<br>"; //Debug line to see what $fp is returning
>
> switch ($fp){
> case 1:
> echo "Valid URL<br>";
> break;
> case 0:
> echo "URL IS NOT VALID<br>";
> $url="http://";
> break;
> }
> echo "New URL = ".$url."<br>";
>
> I get this as a responce on a URL I know is valid (I tested it in my
> browser)
>
> Old URL = http://www.warrenbowley.com
>
> Warning: fopen("http://www.warrenbowley.com","r") - Bad file descriptor in
> /var/www2/html/members/datacopy.php on line 73
> fp =
> URL IS NOT VALID
> New URL = http://
>
>
>
>
> Kenneth R Zink II [EMAIL PROTECTED] ICQ# 5095094
> '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!!
> http://www.s-series.org/htm/windstorm/project-windstorm.htm
> '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!!
> http://www.s-series.org/htm/firestorm/firestorm.htm
> Racing by the Grace of God!!
>
>
>
> > on 3/15/01 04:39 PM, [EMAIL PROTECTED] splat open and thusly melted:
> >
> > > $url=$row[url];
> > >
> > > echo "Old URL = ".$url."<br>";
> > >
> > > $fp = @fopen($url,"r");
> > > if ($fp){
> > > echo "Valid URL<br>";
> > > }else{
> > > echo "URL IS NOT VALID";
> > > $url="http://";
> > > }
> > >
> > > echo "New URL = ".$url."<br>";
> >
> > what exactly do you expect to happen, and what actually happens? i have a
> > feeling, based on your code, that your $url is missing the "http://" part,
> > and the script is failing because of that.
>
>
>
> --
> 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]
>
--
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]