ravix76 Posted June 13, 2011 Share Posted June 13, 2011 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"? Quote Link to comment https://forums.phpfreaks.com/topic/239188-converting-to-static-html-php5-upgrade-problem/ Share on other sites More sharing options...
trq Posted June 13, 2011 Share Posted June 13, 2011 This has nothing to do with any changes in PHP5. allow_url_fopen has been off by default in PHP for a number of years for a number of security concerns. Fix your code to use file paths instead of urls. Quote Link to comment https://forums.phpfreaks.com/topic/239188-converting-to-static-html-php5-upgrade-problem/#findComment-1229006 Share on other sites More sharing options...
PFMaBiSmAd Posted June 13, 2011 Share Posted June 13, 2011 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']; Quote Link to comment https://forums.phpfreaks.com/topic/239188-converting-to-static-html-php5-upgrade-problem/#findComment-1229059 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.