好的 在这里编辑仍然有问题,但与更新代码之前不同
<?php
date_default_timezone_set('Europe/London');
$date = date('Y-m-d H:i:s', time());
$now = date('Y-m-d H:i:s');
$dbhost = "localhost";
$dbuser = "admin_cdm_clap";
$dbpass = "zdqUyFc5bAG1e6TWrIhijH3j7gB8xhmHI4q";
$db = "iTunesConnect";
$driveID = 562220229;
$connect = mysql_connect($dbhost,$dbuser,$dbpass) or die (mysql_error());
mysql_select_db($db);
$query = "SELECT `code` from `countries`";
$result = mysql_query($query) or die (mysql_error());
$num=mysql_num_rows($result);
$i=0;
while ($i < $num) {
$country=mysql_result($result,$i,"code");
$completeUrl = "https://itunes.apple.com/".strtolower($country)."/rss/toppaidapplications/limit=300/genre=6002/xml";
//echo $completeUrl.'<br>';
$xml = simplexml_load_file($completeUrl);
$entries = $xml->entry;
for ($a = 0; $a < 300; $a++) {
//$updated = $entries[$a]->updated;
$id = $entries[$a]->id->attributes('im', true)->id;
$bundle = $entries[$a]->id->attributes('im', true)->bundleId;
$cc = $entries[$a]->id;
$title = $entries[$a]->title;
$category = $entries[$a]->category['term'];
$nUpdated = microtime(true); //strtotime(substr($updated,0,10).' '.substr($updated, 11, 8))
$storeCode = substr($cc, 25, 2);
$storeCat = 6002;
if($id == $driveID){
$rankRec = "INSERT INTO rankings (id, rank, updated, store, category) VALUES (NULL, $a, $nUpdated, '$storeCode','$storeCat')";
mysql_query($rankRec) or die(mysql_error());
} else {
error_reporting(E_ALL);
ini_set('display_errors', '1');
}
}
$i++;
}
?>
我现在收到以下错误;
注意:试图在第 24 行的 /var/www/vhosts/createdm.com/httpdocs/iTunesConnect/iTunesRanking.php 中获取非对象的属性 致命错误:在 / 中的非对象上调用成员函数 attributes()第 24 行的 var/www/vhosts/createdm.com/httpdocs/iTunesConnect/iTunesRanking.php