I've put together a script which allows me to upload an XML file to a mySQL database. The problem I'm having is that after approximately 15 seconds I receive the 'Internet Explorer cannot display the webpage' screen.
Because the file is a little over 5MB I've assumed that the issue is to do with either a 'timeout' or 'filesize' issue within PHP. After some research I thought I'd found a way of changing this, hopefully enabling me to download the file so I inserted these lines at the top of my PHP script.
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
ini_set('memory_limit', '6M'); //6 MB
I've now reloaded the files, and my server, but I'm still getting the same problem and I've run out of why this may be happening.
PHP Code
<?
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
ini_set('memory_limit', '6M'); //6 MB
$objDOM = new DOMDocument();
$objDOM->load("xmlfile.xml");
$Details = $objDOM->getElementsByTagName("Details");
foreach( $Details as $value )
{
$listentry = $value->getElementsByTagName("listentry");
$listentrys = $listentry->item(0)->nodeValue;
$sitetype = $value->getElementsByTagName("sitetype");
$sitetypes = $sitetype->item(0)->nodeValue;
$sitedescription = $value->getElementsByTagName("sitedescription");
$sitedescriptions = $sitedescription->item(0)->nodeValue;
$siteosgb36lat = $value->getElementsByTagName("siteosgb36lat");
$siteosgb36lats = $siteosgb36lat->item(0)->nodeValue;
$siteosgb36lon = $value->getElementsByTagName("siteosgb36lon");
$siteosgb36lons = $siteosgb36lon->item(0)->nodeValue;
//echo "$listentrys :: $sitetypes :: $sitedescriptions :: $siteosgb36lats :: $siteosgb36lons <br>";
require("phpfile.php");
//Opens a connection to a MySQL server
$connection = mysql_connect ("hostname", $username, $password);
if (!$connection) {
die('Not connected : ' . mysql_error());
}
// Set the active MySQL database
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mysql_error());
}
mysql_query("INSERT IGNORE INTO scheduledsites (listentry, sitetype, sitedescription, siteosgb36lat, siteosgb36lon) VALUES('$listentrys','$sitetypes','$sitedescriptions','$siteosgb36lats','$siteosgb36lons') ")
or die(mysql_error());
}
echo "Data Inserted!";
?>