Jump to content

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'];

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.