b3ta.com board
You are not logged in. Login or Signup
Home » Messageboard » Message 2878275 (Thread)

# any PHPers around?
(, Sat 13 Mar 2004, 22:15, archived)
# why
whats the problem?
(, Sat 13 Mar 2004, 22:16, archived)
# i'm wanting a simple way to check whether a URL has the http:// on it
and if not then i'll add it
(, Sat 13 Mar 2004, 22:17, archived)
# look into these two fucntions on php.net
strpos and strstr I will have a look also seeing as I have nothing better to do
(, Sat 13 Mar 2004, 22:20, archived)
# i was going to use parse_url
but i've not used it before and have no idea how it works
(, Sat 13 Mar 2004, 22:21, archived)
# well, heres something to check whether http:// exists
(, Sat 13 Mar 2004, 22:23, archived)
# i think you included a < or > sign in that
(, Sat 13 Mar 2004, 22:24, archived)
# something yes
linked to where I found it
(, Sat 13 Mar 2004, 22:26, archived)
# never heard
of parse_url though

will check it out
(, Sat 13 Mar 2004, 22:28, archived)
#
if(strcmp(substr($url, 0, 7), 'http://') == 0)

then it has http:// on the front.

(zero from strcmp means the same)

not sure if the slashes in that string will cause problems, but it's in single quotes so presumably not.
(, Sat 13 Mar 2004, 22:30, archived)