HELP: loading a url with simplexml that has a string in it
Posted: Sun Jun 06, 2010 11:09 pm
Hi i am new to php and am trying to write a page that parsing some xml using simplexml and i think i have managed to learn most of it but I am having a problem with loading a url to be parsed that has a variable loaded from a text box.
Here is the code that i thought would work:
when i try to load the page once something has been entered in the text box on the other page i get an error, for this example i entered 'Transformers' into the text field and loaded the page and this is the error that i got:
Any help as to what i am doing wrong would be appreciated.
Thanks
Here is the code that i thought would work:
Code: Select all
<?php
$moviename = $_POST['moviename'];
$xml = simplexml_load_file("http://api.themoviedb.org/2.1/Movie.search/en/xml/.../%s\n", $moviename);
?>
Code: Select all
Warning: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Transformers' given in D:\Apache\htdocs\MovieCatalogue\movieresults.php on line 3Thanks