note 93037 added to function.parse-url

From: Date: Thu, 20 Aug 2009 10:35:01 +0000
Subject: note 93037 added to function.parse-url
Groups: php.notes 
Request: Send a blank email to php-notes+get-159683@lists.php.net to get a copy of this message
be sure to use trim($url) before using parse_url($url) when your script is handling with userinput. <?php $url = $_POST['url']; // If $_POST['url'] would be "http://php.net" everything would be fine. // What if it is " http://php.net" (Watch the space in front of the url!)? $urlcontents = parse_url($url, PHP_URL_HOST); // Now $urlcontents Would be "__http" $url = trim($url); $urlcontents = parse_url($url, PHP_URL_HOST); // $urlcontents would be "php.net ?> ---- Server IP: 212.124.37.9 Probable Submitter: 88.217.31.199 ---- Manual Page -- http://www.php.net/manual/en/function.parse-url.php Edit -- https://master.php.net/note/edit/93037 Del: integrated -- https://master.php.net/note/delete/93037/integrated Del: useless -- https://master.php.net/note/delete/93037/useless Del: bad code -- https://master.php.net/note/delete/93037/bad+code Del: spam -- https://master.php.net/note/delete/93037/spam Del: non-english -- https://master.php.net/note/delete/93037/non-english Del: in docs -- https://master.php.net/note/delete/93037/in+docs Del: other reasons-- https://master.php.net/note/delete/93037 Reject -- https://master.php.net/note/reject/93037 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159683) next »