Skip to content

Instantly share code, notes, and snippets.

@RSquaredSoftware
Created March 5, 2012 03:29
Show Gist options
  • Save RSquaredSoftware/1976308 to your computer and use it in GitHub Desktop.
Save RSquaredSoftware/1976308 to your computer and use it in GitHub Desktop.
<?php
//connect to the xml and create an xml object from it
$session = curl_init('http://www.chinabuye.com/mivec/rss/data/apple.xml');
curl_setopt($session, CURLOPT_RETURNTRANSFER,true);
$xml = new SimpleXMLElement(curl_exec($session));
//craete the csv file
$apple = "apple.csv";
$handle = fopen($apple, 'a');
$data = array();
foreach ($xml->xpath("item") as $item){
echo $item->name;
echo $item->description;
echo $item->sku;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment