PriceDropsReport

 

[php]

<?php
$con = mysql_connect(“localhost”,”smtakca_samet”,”smtgs.252″);
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}
mysql_select_db(“smtakca_feeds”, $con);
mysql_query(“truncate table feedstest;”);
$x = 0;
$doc = new DOMDocument();
$doc->load(‘http://appshopper.com/feed/?device=Iphone&mode=featured&filter=price’);
$arrFeeds = array();
foreach ($doc->getElementsByTagName(‘item’) as $node) {
$itemRSS = array (
“title”=> $node->getElementsByTagName(“title”)->item(0)->nodeValue,
“desc” => $node->getElementsByTagName(“description”)->item(0)->nodeValue,
“link” => $node->getElementsByTagName(“link”)->item(0)->nodeValue,
“date” => $node->getElementsByTagName(“pubDate”)->item(0)->nodeValue
);

$titlex = str_replace(“‘”,””,$itemRSS[‘title’]);
$descx = str_replace(“‘”,””,$itemRSS[‘desc’]);
$datx = $itemRSS[‘date’];
$linkx = str_replace(“‘”,””,$itemRSS[‘link’]);
$x += 1;

// echo $descx . “<br/>”;

$myq = “INSERT INTO feedstest VALUES (DEFAULT,'” . $descx . “‘,'” . $titlex . “‘,'” . $linkx . “‘,’2013-02-21’,1)”;
$rt = mysql_query($myq);

/* if($rt)
{echo ” Command is successful “;}
else
{echo mysql_error();}*/
}

$doc1 = new DOMDocument();
$doc1->load(‘http://appshopper.com/feed/?device=Ipad&mode=featured&filter=price’);
$arrFeeds = array();
foreach ($doc1->getElementsByTagName(‘item’) as $node) {
$itemRSS = array (
“title”=> $node->getElementsByTagName(“title”)->item(0)->nodeValue,
“desc” => $node->getElementsByTagName(“description”)->item(0)->nodeValue,
“link” => $node->getElementsByTagName(“link”)->item(0)->nodeValue,
“date” => $node->getElementsByTagName(“pubDate”)->item(0)->nodeValue
);

$titlex = str_replace(“‘”,””,$itemRSS[‘title’]);
$descx = str_replace(“‘”,””,$itemRSS[‘desc’]);
$datx = $itemRSS[‘date’];
$linkx = str_replace(“‘”,””,$itemRSS[‘link’]);
$x += 1;

$myq = “INSERT INTO feedstest VALUES (DEFAULT,'” . $descx . “‘,'” . $titlex . “‘,'” . $linkx . “‘,’2013-02-21’,2)”;
$rt = mysql_query($myq);

/* if($rt)
{echo ” Command is successful “;}
else
{echo mysql_error();} */

}

$doc2 = new DOMDocument();
$doc2->load(‘http://appshopper.com/feed/?device=mac&mode=featured&filter=price’);
$arrFeeds = array();
foreach ($doc2->getElementsByTagName(‘item’) as $node) {
$itemRSS = array (
“title”=> $node->getElementsByTagName(“title”)->item(0)->nodeValue,
“desc” => $node->getElementsByTagName(“description”)->item(0)->nodeValue,
“link” => $node->getElementsByTagName(“link”)->item(0)->nodeValue,
“date” => $node->getElementsByTagName(“pubDate”)->item(0)->nodeValue
);

$titlex = str_replace(“‘”,””,$itemRSS[‘title’]);
$descx = str_replace(“‘”,””,$itemRSS[‘desc’]);
$datx = $itemRSS[‘date’];
$linkx = str_replace(“‘”,””,$itemRSS[‘link’]);
$x += 1;

$myq = “INSERT INTO feedstest VALUES (DEFAULT,'” . $descx . “‘,'” . $titlex . “‘,'” . $linkx . “‘,’2013-02-21’,3)”;
$rt = mysql_query($myq);

/* if($rt)
{echo ” Command is successful “;}
else
{echo mysql_error();} */

}
mysql_close($con);

echo “THE END ” . $x;
?>

[/php]