[PHP]Using Curl with DOMDocument

Associate
Joined
21 May 2003
Posts
1,365
Is it possible to get around remote files being unavailable using Curl?

My webhost have turned off allow_url_fopen so I can't use a DOMDocument->load() directly, but is it possible to get the data using curl and then using the core DOM functions to grab the result as an XML object?
 
Cheers guys, i'll give it a try tomorrow.

Just out of interest is having allow_url_fopen turned on a massive security threat? I think it's on by default on most PHP installs?
 
I've never used the XML features of PHP before, so could someone give me a quick run through of how to grab stuff please? I've tried the example at http://weblog.bignerdranch.com/?p=8 but childNodes doesn't seem to be returning anything.

Code:
<?php
	$xmlString = 
	'<Voucher>
		<VoucherID>1234567</VoucherID>
		<VoucherCode>ABCDEFGHIJKLM</VoucherCode>
	</Voucher>';
	
	$Dom->loadXML($xmlString);
	
	$voucher = $Dom->getElementsByTagName('Voucher');

	
?>

In the above example, how do I get VoucherID or VoucherCode values to assign to php vars?
 
Back
Top Bottom