Witam, chciałbym napisać skrypt który pobierał by dane z takich plików xml
http://clodogame.fr/dev/api/user.97.xml pobierając id (np.97) z pliku tekstowego. Następnie wrzucało dane do sql. Wyskakuje mi błąd:
Warning: simplexml_load_file(http://clodogame.fr/dev/api/user.70%0D%0A.xml) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\Strony\sql.php on line 15
Warning
: simplexml_load_file
() [function.simplexml
-load
-file]: I
/O warning
: failed to load external entity
"http://clodogame.fr/dev/api/user.70%0D%0A.xml" in C
:\Strony\sql
.php on line
15Nie mozna przeniesc gracza ! Table 'myhighscore.gracze' doesn't exist
Skrypt wygląda tak:
<?
$sql['server'] = "db4free.net:3306";
$sql['username'] = "trecco";
$sql['password'] = "********";
$sql['database'] = "myhighscore";
foreach($plik as $p)
{
$xml = simplexml_load_file("http://clodogame.fr/dev/api/user.".$p.".xml");
$id = $xml['id'];
$name = $xml['name'];
$points = $xml['points'];
$position = $xml['position'];
$gangname = $xml->gang['name'];
$query = mysql_query("INSERT INTO `gracze` (`id`,`name`,`points`,`position`,`gangname`) VALUES('NULL','$id','$name','$points','$position','$gangname')") or
die("Nie mozna przeniesc gracza $name! ".mysql_error()); echo "<p>Gracz $name zostal przeniesiony poprawnie!</p>"; }
?>
Plik tekstowy:
70
117
97
89
575
28
95
528
489
263
130
568
96
645
341
608
262
42
381
91
Strasznie byłbym wdzięczny za pomoc.
Ten post edytował Trecco 22.08.2009, 12:06:39