Re: Fopen help

From: Date: Sat, 24 Mar 2001 01:23:54 +0000
Subject: Re: Fopen help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45389@lists.php.net to get a copy of this message
Basically, you shouldn't be checking for '1' as an answer. Either you got 0, and it didn't work, or you didn't, and the URL is valid. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: "Kenneth R Zink II" <Hellcat1@EV1.Net> Newsgroups: php.general Sent: Thursday, March 22, 2001 3:47 PM Subject: [PHP] Fopen help I'm trying to use Fopen to check and see if a URL exist with this bit of code. $url=$row[url]; echo "<strong>Old URL = ".$url."</strong><br>"; $urlcheck = fopen($url,"r"); echo "urlcheck = ".$urlcheck."<br>"; switch ($url){ case "": case "http://": echo "<strong>No URL Set</strong><br>"; break; default: switch ($urlcheck){ case 1: echo "<strong>Valid URL</strong><br>"; break; case 0: echo "<strong>URL Is Not Valid</strong><br>"; $url="http://"; break; default: echo "<strong>Fopen Did Not Work</strong><br>"; } break; } echo "<strong>New URL = ".$url."</strong><br>"; So far all I can get it to do is the default response. Can someone point out what I'm doing wrong or tell me how to see what the contents of a resource id is please? Old URL = http://www.s-series.org/htm/firestorm/firestorm.htm urlcheck = Resource id #4 Fopen Did Not Work New URL = http://www.s-series.org/htm/firestorm/firestorm.htm Kenneth R Zink II Hellcat1@S-Series.Org 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 '84 5.0L (307 "Y") Carbed Oldsmobile Delta 88 Royal Brougham. Daily driver until FireStorm is ready. Racing by the Grace of God!!

« previous php.general (#45389) next »