Talk:XML Data PHP Example

From YWAMKnowledgeBase

Jump to: navigation, search

WOW! --Kev-The-Hasty 16:41, 6 July 2007 (BST)

This didn't work for me. I think the problem is that you're trying to access a remote file using fopen. In my scripts, I use curl to open a remote file. I tried to replace some of the code with my curl code, but it didn't work. I probably don't understand the code enough to replace the right stuff.

Here's my code though in case someone else can do something with it:

$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://www.example.com/xmlfile.xml');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$xmlfile = curl_exec($ch);
curl_close($ch);

--reblevins 16:34, 5 September 2007 (CEST)

Personal tools