Jump to content

Converting to Static HTML - PHP5 Upgrade Problem


ravix76

Recommended Posts

I had a script which converted my dynamically produced pages into static HTML. This was to ease indexing and reduce server loads.

Following a host move, to one which has PHP5, I can no longer get the script to work:

 

<?php
# Set Names for Static Build Pages
$sourcepage = "http://www.mysitename.com/dynamicfiles/productpage.php?id=".$row['id'].";
$tempfilename = "../dynamicfiles/temp_file.php";
$targetfilename = "../".$branddirectory.$productfilename; 
# Run PHP Conversion
$htmldata = file_get_contents($sourcepage);
?>

 

I get the error: "URL file-access is disabled in the server configuration" and after some hunting around, understand this is due to a change in PHP5, related to "allow_url_fopen".

Can anyone recommend a work around or do I need to enable "allow_url_fopen"?

See example #6 at the following link on how you can include a file through the file system and get the resulting output into a variable - http://us2.php.net/manual/en/function.include.php

 

If your code is expecting specific get variables to exist, you set them up before including the file and you would remove any get parameters form the end of the filename because get parameters are specific to having a URL -

 

$_GET['id'] = $row['id'];

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.