Possible Duplicate:
Sanitize file path in PHP
I have a php script that looks like this:
$search = $_REQUEST['search'];
$xml = simplexml_load_file("SOMEURL/search?q=".$search);
I'm wondering what is the correct way to stop people trying to load files or webpages by changing the search parameter.
I am fully aware of SQL Injection issues and know how to handle them, but I'm unsure as to the best method for securing the location of a file with user input.
I look forward to your replies.
EDIT
I am adding more detail to this question as it is marked as a duplicate to a post which does not answer what I'm after.
I have a php script on a Linux box that is using simplexml_load_file to query a SEARCH ENGINE Java (not javascript) script running on a Windows box. The user can change the search term to be anything that the user wishes as it's a search engine. The script on the Windows box returns back XML which the PHP code then uses for display purposes.
I would like to make sure that users cannot change the Search parameter to load another url or file.