note 54974 added to function.simplexml-load-file

From: Date: Thu, 21 Jul 2005 11:31:39 +0000
Subject: note 54974 added to function.simplexml-load-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-92247@lists.php.net to get a copy of this message
An important thing to note is that the argument to simplexml_load_file() is not a file name, but it has to be an encoded file name. If you try to do : simplexml_load_file('http://example.com/a=' . urlencode('b&c')); The function will load http://example.com/a=b&c which means that the content of 'a' will be 'b' not 'b&c', as if urlencode() was pointless. You *must* rawurlencode() every URL passed to simplexml_load_file() in order to have it work as expected, or you can even get unwanted security flaws : simplexml_load_file(rawurlencode('http://example.com/a=' . urlencode('b&c'))); And you get the right behavior. ---- Manual Page -- http://www.php.net/manual/en/function.simplexml-load-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54974 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54974&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54974&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54974&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54974&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54974&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54974&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54974&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#92247) next »