Re: [PHP] Correct URL's

2002-01-27 Thread David Robley

In article 007901c1a588$120a6150$3c01a8c0@quasimodo, 
[EMAIL PROTECTED] says...
 - Original Message -
 From: Alexander Weber [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, January 25, 2002 10:34 AM
 Subject: Re: [PHP] Correct URL's
 
 
  Stefan Rusterholz wrote
SNIP
  Please do not send HTML messages.
 Sorry, Outlook is crap and I'm just too lazy to buy (on Win you have to buy
 almost everything) another e-mail client for my working machine.

http://www.pegasus.org/

It's free and a bit more virus resistant than a certain M$ product (well, 
any M$ product)

-- 

-- 
David Robley
Temporary Kiwi!

-- 
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] Correct URL's

2002-01-27 Thread Dave Brotherstone

 
   Stefan Rusterholz wrote
 SNIP
   Please do not send HTML messages.
  Sorry, Outlook is crap and I'm just too lazy to buy (on Win you
 have to buy
  almost everything) another e-mail client for my working machine.

 http://www.pegasus.org/

 It's free and a bit more virus resistant than a certain M$ product (well,
 any M$ product)

 --

www.pmail.com ?  pegasus.org is *definately* virus free, (it's a yachting
team!!!)


-- 
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] Correct URL's

2002-01-27 Thread Alan McFarlane

   Please do not send HTML messages.
  Sorry, Outlook is crap and I'm just too lazy to buy (on Win you have to

??? Outlook does not ~need~ to send HTML messages, it can be configured to
send text-only messages

Sheesh, It's about time you guys started looking properly at your
environments and learning how to use properly instead of just slanging MS

David Robley [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 In article 007901c1a588$120a6150$3c01a8c0@quasimodo,
 [EMAIL PROTECTED] says...
  - Original Message -
  From: Alexander Weber [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, January 25, 2002 10:34 AM
  Subject: Re: [PHP] Correct URL's
 
 
   Stefan Rusterholz wrote
 SNIP
   Please do not send HTML messages.
  Sorry, Outlook is crap and I'm just too lazy to buy (on Win you have to
buy
  almost everything) another e-mail client for my working machine.

 http://www.pegasus.org/

 It's free and a bit more virus resistant than a certain M$ product (well,
 any M$ product)

 --

 --
 David Robley
 Temporary Kiwi!



-- 
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] Correct URL's

2002-01-25 Thread Stefan Rusterholz

Hi

I have a HTML-Form where user's can enter their website-address. Some of you know the 
resulting problem for sure: most users enter www.php.net, some users enter 
http://www.php.net; and some others enter http://www.php.net/;. The last version is 
IMHO the most correct form. (http://www.php.net; is commonly used, but afaik it's 
either the webbrowser or the webserver which appends the missing /).
So my problem was to rewrite the url's so that entered URL's will be displayed 
correct, no matter how the user entered it. For this purpose I wrote following 
function:

function rewriteURL($url, $base=){
  $purl = parse_url($url);
  if (!isset($purl['scheme']) || (!$purl['scheme'])){
   $url = http://.$url; }
  $purl = parse_url($url);
  if ((!isset($purl['path'])) || (!$purl['path'])){
   $url .= '/'; }
  return $url;
 }

My Questions:
-Are there URLs which could be entered correct and become wrong when rewritten with 
that function? (Yes, I have tested the function myself, but there are too many 
possibilities so it's impossible for me to cover all of them)
-What was the best way to check, if the give address really exists? (I thought on a 
test like this:
$exists = true;
@fopen($url) or $exists = false;
return $exists;)

TIA
Stefan Rusterholz



Re: [PHP] Correct URL's

2002-01-25 Thread Alexander Weber

Stefan Rusterholz wrote:
 
Part 1.1Type: Plain Text (text/plain)
Encoding: quoted-printable
 What was the best way to check, if the give address really exists?
Just try this function:

http://www.php.net/manual/en/function.gethostbyname.php

It returns the IP address of the given domain. Normally a domain can be
accessed by the browser if it has a valid IP address and everything is
configured correctly.

Please do not send HTML messages.

Alexander

-- 
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] Correct URL's

2002-01-25 Thread Stefan Rusterholz

- Original Message -
From: Alexander Weber [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 25, 2002 10:34 AM
Subject: Re: [PHP] Correct URL's


 Stefan Rusterholz wrote
  What was the best way to check, if the give address really exists?
 Just try this function:

 http://www.php.net/manual/en/function.gethostbyname.php

 It returns the IP address of the given domain. Normally a domain can be
 accessed by the browser if it has a valid IP address and everything is
 configured correctly.

But if I understand this function right, It will only work for URLs like
http://www.php.net/ - what if the user has a free space from his ISP which
is located in a subdir like http://www.php.net/users/myhome/?

 Please do not send HTML messages.
Sorry, Outlook is crap and I'm just too lazy to buy (on Win you have to buy
almost everything) another e-mail client for my working machine.
But I finally moved my ass and changed the options to send text-only
mails. I hope you are happy now :) (m$ thought it was a good idea to hide
those options as good as possible - I disagree with them, but that's just
normal ;-)

 Alexander
Stefan


-- 
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] Correct URL's

2002-01-25 Thread Alexander Weber

Stefan Rusterholz wrote:
  http://www.php.net/manual/en/function.gethostbyname.php
 But if I understand this function right, It will only work for URLs like
 http://www.php.net/ - what if the user has a free space from his ISP which
 is located in a subdir like http://www.php.net/users/myhome/?

If you want to check subdirs you have to connect to the URL and look at
the response. 
You should use gethostbyname to check the domain (use some regular
expressions on the URL) and then try to connect to the server and send a
HTTP request (fsockopen and some other functions). 
Then you can check the response for error messages like 404.

Alexander

-- 
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]