Я не могу поместить свой файл в каталог ...
$swfpath = "swf/";
file_put_contents($swfpath . $swf, file_get_contents($swf_url));
он переходит в /example.swf
вместо /swf/example.swf
<?php
include "mysql.php";
echo "you shouldn't be here";
$gt = $_POST["game_tag"];
connect() or die (mysql_error());
$pubId = 'censored';
if (!$gt)
exit;
$data = file_get_contents("http://www.mochimedia.com/feeds/games/$pubId/$gt/?format=xml");
$response = new DOMDocument();
$response->loadXML($data);
$obj = $response->getElementsByTagName("entry")->item(0);
$sql = "INSERT INTO games (title, swfname, description, category, thumb) VALUES('";
$sql .= addslashes($obj->getElementsByTagName("title")->item(0)->nodeValue) . "','";
$swf_url = $obj->getElementsByTagName("link")->item(1)->getAttribute("href");
$swf = md5($sql);
$swfpath = "swf/";
file_put_contents($swfpath . $swf, file_get_contents($swf_url));
echo " URL = $swf_url";
$sql .= "$swf','"; //swfpath is the path of the directory where you store the swf files
$sql .= addslashes($obj->getElementsByTagName("description")->item(0)->nodeValue) . "','";
switch($obj->getElementsByTagName("category")->item(0)->nodeValue) {
case "Action" : $sql .= "act','"; break;
case "Shooting" : $sql .= "s','"; break;
case "Shooter" : $sql .= "s','"; break;
case "Classic" : $sql .= "c','"; break;
case "Arcade" : $sql .= "a','"; break;
default : $sql .= "m','"; break;
}
include "functions.php";
$thumbnail_url = $obj->getElementsByTagName("thumbnail")->item(0)->getAttribute("url");
$thumb = substr($thumbnail_url, -4, 4);
$thumbs = "".$gt."$thumb";
$thumbpath = "thumbs/";
file_put_contents($thumbpath . $thumbs, file_get_contents($thumbnail_url));
$sql .= "$thumbs');"; //thumbpath is the path of the directory where you store the thumb files
mysql_query("$sql") or die (mysql_error());
//insert the $sql to your database
?>