Jump to content

convert url's to http:// ???


newb

Recommended Posts

how do i convert google.com or if the user inputs www.google.com to http:// or if they already have http:// it wont add the extra http:// like in vbulletin?? does anyone know how i been trying to figure it out i dont kno how to do it someone pleeze give me example pls help thanks im new at php idk where 2 start.
Link to comment
Share on other sites

thx. i revised it a bit so it checks if the user inputs just www.google.com or google.com

[code]
<?php
if (!strstr($url,'http://')) {
if (strstr($url,'www')) {
$url = 'http://'.$url;
} else {
    $url = 'http://www.'.$url;
  }
}
?>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.