Hi,
I parsed my xml product feed but when i uploaded it to my domain and open it, it comes up with an error:
Parse error: syntax error, unexpected T_STRING in /www/zxq.net/x/c/l/xclusivegigs/htdocs/XclusiveGigs.php on line 14
The pHp file is below:
PHP Code:
<?php
//connects to our database
require_once('db_connect.inc');
db_connect();
//create instance of XMLReader
$xmlReader = new XMLReader();
//define the filename we wish to write to and the url we wish to download from
$filename = "Ticketmaster_UK_Events.xml";
$url = "http://feeds.perfb.com/index.php/download?OEMAIL=adityakishor@hotmail.com&PX=1c53a6624ce5b96bcd7bf7c7971ffcfa&DISPLAYFORMAT=XMLGZIP&REVERSEMAPXML=yes&PRODUCTDB_ID=306"
//this creates the file "feed_download".xml and takes he contents from the URL and stores them into the file
file_put_contents(‘Ticketmaster_UK_Events.xml’, file_get_contents(http://feeds.perfb.com/index.php/download?OEMAIL=adityakishor@hotmail.com&PX=1c53a6624ce5b96bcd7bf7c7971ffcfa&DISPLAYFORMAT=XMLGZIP&REVERSEMAPXML=yes&PRODUCTDB_ID=306));
//read in xml file
$xmlReader->open(‘Ticketmaster_UK_Events.xml’);
//loop to read in data
while ($xmlReader->read())
{
switch ($xmlReader->name)
{
//this finds the parent node for each instnc of a product
case 'product':
//this initialises the xml parser
$dom = new DOMDocument();
$domNode = $xmlReader->expand();
$element = $dom->appendChild($domNode);
$domString = utf8_encode($dom->saveXML($element));
$product = new SimpleXMLElement($domString);
//read in data
$product_code = $product->product_code;
$product_name = $product->product_name;
$leval1 = $product->level1;
$description = $product->description;
$short_deeplink = $product->buyat_short_deeplink_url;
$oldstyle_deeplink = $product->old_style_deeplink_url;
$image_url = $product->image_url;
$currency = $product->currency;
$availability = $product->availability;
$apr_full = $product->APR_full;
$apr = $product->APR;
$balancetransfer_free = $product->BT_Free;
$interest_free_period = $product->interest_free_period;
$credit_limit = $product->credit_limit;
$benefits = $product->benefits;
$company_text = $product->company_text;
//insert query
if(strlen($product_code) > 0) //product_id is chosen because there must be an id for each product
{
$query = mysql_query("REPLACE INTO seatwave
(product_code, product_name, level1, description, short_deeplink, oldstyle_deeplink, image_url, currency,
availability, apr_full, apr, balancetransfer_free, interest_free_period, credit_limit, benefits, company_text)
VALUES ('$product_code', '$product_name', '$level1', '$description', $short_deeplink', '$oldstyle_deeplink',
'$image_url', '$currency',
'$availability', $apr_full', '$apr', '$balancetransfer_free', '$interest_free_period', '$credit_limit', '$benefits',
'$company_text')");
echo $product_name . "has been inserted </br>";
}
break;
}
}
?>
Can someone please tell me how to fix this?
Thank You
Bookmarks