Re: [PHP] Checking url validation
Try an extra layer of parens: if (($fp = fopen(http://www.anyurl.com;, r) == NULL) { echo not valid; } else { echo this is a valid url; } Roberts, Mark wrote: I am using the following to verify a url: if (!$fp = fopen(http://www.anyurl.com;, r)) { echo not valid; } else { echo this is a valid url; } I always get a not valid message. What am I doing wrong? Is there a better way to do this? Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- /-=[ BILLY S HALSEY ]=--\ | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW | | All opinions and technical advice offered in this message are my | | own and not necessarily endorsed by my employer. | \--=[ [EMAIL PROTECTED] ]=/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking url validation
Oops ... That's not balanced. Add another ) at the end of the if. /bsh/ Billy S Halsey wrote: Try an extra layer of parens: if (($fp = fopen(http://www.anyurl.com;, r) == NULL) { echo not valid; } else { echo this is a valid url; } Roberts, Mark wrote: I am using the following to verify a url: if (!$fp = fopen(http://www.anyurl.com;, r)) { echo not valid; } else { echo this is a valid url; } I always get a not valid message. What am I doing wrong? Is there a better way to do this? Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- /-=[ BILLY S HALSEY ]=--\ | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW | | All opinions and technical advice offered in this message are my | | own and not necessarily endorsed by my employer. | \--=[ [EMAIL PROTECTED] ]=/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] checking url
well, you can try fsockopen. see it on php.net/fsockopen it will even return you an error if not connected. start from the example describing the function on PHP.net/fsockopen (did I misspelled it?) Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Dmitry [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 25, 2001 5:44 AM To: [EMAIL PROTECTED] Subject: [PHP] checking url Hello all. Can you tell me, how can I check url address? Also I want to know error, which return. Dmitry -- 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]
Re: [PHP] checking url
Hi Dmitry, In case you want a regular expression to check if it is a valid url you can try this... $url = yoururl; if(empty($url) !eregi(^http://[A-Za-z0-9\%\?\_\:\~\/\.-]+$,$url)) $errmsg=$url doesn't look like a valid URL\n; I hope this helps. Subodh Gupta I have learned, Joy is not in things, it is in us. You will ultimately be known by what you give and not what you get. - Original Message - From: Dmitry [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 25, 2001 2:14 AM Subject: [PHP] checking url Hello all. Can you tell me, how can I check url address? Also I want to know error, which return. Dmitry -- 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]
Re: [PHP] checking url
How do you mean, check? Do you want to use a regular expression to see if it's a valid URL, or do you want to open a connection to it and see if the site actually exists? -- Plutarck Should be working on something... ...but forgot what it was. Dmitry [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello all. Can you tell me, how can I check url address? Also I want to know error, which return. Dmitry -- 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]