Posted By

iloveitaly on 06/01/10


Tagged

url http check link protocol external force ensure


Versions (?)

Force HTTP:// on URL


 / Published in: PHP
 

  1. function external_link($urlString) {
  2. $urlString = trim($urlString);
  3.  
  4. if($urlString) {
  5. $urlString = preg_replace('/https?:\/\//', '', $urlString);
  6. $urlString = trim($urlString);
  7. $urlString = 'http://'.$urlString;
  8. }
  9.  
  10. return $urlString;
  11. }

Report this snippet  

You need to login to post a comment.