Fetching a remote XML doc: 2

Source code


<?php include('./.config.php');
// Four ways to fetch an XML document via http: Part 2 of 4
// Use cURL. It's fast, it's easy and it works.

$ch curl_init("http://rss.news.yahoo.com/rss/oddlyenough");
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
$xml curl_exec($ch);
curl_close($ch);
echo 
'<pre>'htmlentities($xml) .'</pre>'
10 
11 include(
'./.footer.php')?>

Output

<!-- rc3.ops.sp1.yahoo.com uncompressed/chunked Sat May 19 11:11:57 UTC 2012 -->
previous: Fetching a remote XML doc: 1
next: Fetching a remote XML doc: 3


Last update 24-Apr-2005 2:22 pm | up | list examples | home