Hey guys,
it seems that so far in my little script everything is working except for the MySQL insert
Nothing seems to appear in the table it's supposed to insert too but i dont see any errors anywhere.
Any help would be appreciated.
I know it's very messy but it's my first actual 'project'
<?php
$apiKey="<omitted>";
$playeritemsURL="http://api.steampowered.com/IEconItems_440/GetPlayerItems/v0001/";
$fullURL=$playeritemsURL."?key=".$apiKey."&SteamID=".$_GET["SteamID64"]."&format=xml";
$playerLocalName=$_GET["SteamID64"].".xml";
$ch=curl_init($fullURL);
$fh=fopen($playerLocalName, 'w');
?>
You entered ID: <?php echo $_GET["SteamID64"];?></br>
<?php
echo $fullURL;
curl_setopt($ch,CURLOPT_FILE,$fh);
curl_exec($ch);
curl_close($ch);
?>
</br>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("csv_db", $con);
$readXML=file_get_contents($playerLocalName);
$xml=simplexml_load_file($playerLocalName);
$output=$_GET["SteamID64"].".defindex.txt";
$fh=fopen($output, 'w') or die("can't open file");
//echo $xml->items->item->defindex[0];
foreach ($xml->xpath('//defindex') as $defindex)
{
fwrite($fh, $defindex."\n");
echo $defindex."</br>";
mysql_query("INSERT INTO ".$_GET["SteamID64"]." (defindex) VALUES (".$defindex.")");
}
?>