I am trying to load Google custom XML search results into a PHP page and then manipulate the XML using JQuery.
I understand that I can't use javascript to grab the XML file as it's on an external domain but can I use PHP to grab the XML from the server and then make it available to JQuery as an XML file, or other DOM structure, so I can then traverse that XML using, for example:
$(resultXml).find("R").each(function(){
$("ul.results").append("<li>"+$(this).find("S")+"</li>");
});
where resultXml is the XML object.
The XML url is something like this:
http://www.google.com/cse?cx=XXXXXXX&client=google-xxxx&output=xml_no_dtd&q=$keyword
Where the $keyword is passed to the PHP page in the GET string.
I'm good with the front-end stuff but less so with server-side (which is why I'm not parsing the XML in PHP) and I'm puzzled how I would go about grabbing the XML in PHP and converting that into a form JQuery can parse (using json_encode perhaps?). I have read about several ways of including an external file in PHP using functions like fopen but there seem to be a lot of caveats about proxies and permissions.
Thanks.