note 68956 added to ref.url

From: Date: Thu, 17 Aug 2006 10:04:57 +0000
Subject: note 68956 added to ref.url
Groups: php.notes 
Request: Send a blank email to php-notes+get-116000@lists.php.net to get a copy of this message
How do I go and encode an URL, but EVERYTHING is encoded. As such: http://www.domain.com/ ...becomes... %68%74%74%70%3a%2f%2f%77%77%77%2e%64%6f%6d%61%69%6e%2e%63%6f%6d This one does what you want <?php $text = 'http://www.domain.com/'; $output = ''; $tab_text = str_split($text); foreach ($tab_text as $id=>$char){ $hex = dechex(ord($char)); $output .= '%' . $hex; } echo $output; ?> ---- Server IP: 83.64.128.68 Probable Submitter: 150.254.201.18 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/ref.url.php Edit -- https://master.php.net/note/edit/68956 Del: integrated -- https://master.php.net/note/delete/68956/integrated Del: useless -- https://master.php.net/note/delete/68956/useless Del: bad code -- https://master.php.net/note/delete/68956/bad+code Del: spam -- https://master.php.net/note/delete/68956/spam Del: non-english -- https://master.php.net/note/delete/68956/non-english Del: in docs -- https://master.php.net/note/delete/68956/in+docs Del: other reasons-- https://master.php.net/note/delete/68956 Reject -- https://master.php.net/note/reject/68956 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116000) next »