By ContentChris on
I've added the following code to the module im developing to eventually read in the Amazon XML but its now just with a test xml.
$datafetch = drupal_http_request('http://stats.enemyterritory.com/clan/341?xml=true');
$data = $datafetch->data;
if($data==""){ echo "EMPTY"; }Seeing it echo's the string EMPTY $data appears to be empty, therefor drupal_http_request() appears not to be getting any xml content from that url.
But even if I use an Amazon url (http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&Operation=..., between the [] is ofcourse a proper AccessKey but I removed it for poasting purposes), drupal_http_request() isn't geting any xml data.
Am I using drupal_http_request() incorrect or is it perhaps a setting in Drupal that has to be enabled to make it possible ?
Comments
Using XML Reader on external file
Hi I'm having a similar issue. I tried the first one using http_request and then as that wasn't working decided to try copying the file to a directory and importing via command line script I use for CSV. My issue is below (forum admin please excuse the cross post but they might be related issues?)
I am trying to import a large number of records which I pick up in an xml file from a 3rd party database supplier for our film festival. The supplier cannot do it as an RSS feed so I'm stuck having to import it via SAX or XMLReader. I have a command line script I use to import csv records which I run from the root of my drupal directory and which works fine (quick and dirty but it uses the Drupal API by including bootstrap and I was able to get 8,000 records imported in about 10 seconds).
However when I adapt the script to use XMLReader I get nothing when invoking it. var_dump of objects returns NULL. When I test the script on the command line from outside of Drupal it works as it should. Am I missing a call to include something else from Drupal core or something in settings.php?
Any direction would be much appreciated.
Thanks!!
header
it is possible that you need to use put the rest of the parameters for drupal_http_request like method and header and data , that would depend on amazon or enemyterritory configuration