[RESOLVED] PHP4 include code not working in PHP5

windows

Guest
Hello,

The following code is showing up correct page in PHP4 and not in PHP5:

@(include("http://feed.textxx.com/dir/files/feed/celxx.com/index.php"))
OR die ("Server is down for maintenance. Please try again later.");


Will someone kindly correct this code so that it shows up the remote page correctly in PHP5.

Thanking you,

Lakshmanan S.I would start by removing the "@" from the start of the command to see if the PHP is generating an error message that will give you more information as to what the problem is. If nothing is reported, you may need to activate full error reporting:

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
(include("http://feed.textxx.com/dir/files/feed/celxx.com/index.php"))
OR die ("Server is down for maintenance. Please try again later.");

My first guess is that the server in question is not configured to allow includes via http (only via the local file system).Hello,

Thanks for your valuable suggestion.

We have added the error reporting codes as suggested by you.

We are now getting the following error message:
-------------------------------------------------------------------
Warning: include(): URL file-access is disabled in the server configuration in /hsphere/local/home/xxx/xxxx.com/clxc/index.php on line 4 Warning: include(<!-- m --><a class="postlink" href="http://feed.textxxxx.com/dir/files/feed/xxx.com/index.php">http://feed.textxxxx.com/dir/files/feed ... /index.php</a><!-- m -->): failed to open stream: no suitable wrapper could be found in /hsphere/local/home/xxx/xxxx.com/clxc/index.php on line 4 Warning: include(): Failed opening 'http://feed.textxxxx.com/dir/files/feed/xxx.com/index.php' for inclusion (include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in /hsphere/local/home/xxx/xxxx.com/clxc/index.php on line 4 Server is down for maintenance. Please try again later.
-------------------------------------------------------------------

We had taken up this issue with our host and they had replied to us as follows:
-------------------------------------------------------------------
we do not restrict or disallow includes from remote servers

check your code, its not correct for server running php5

yes it will work on php4
-------------------------------------------------------------------

Now it is clear and they have to do the needful. We would take up this issue with them.

Thanks a lot,

Lakshmanan S.I would start by removing the "@" from the start of the command to see if the PHP is generating an error message that will give you more information as to what the problem is. If nothing is reported, you may need to activate full error reporting:

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
(include("http://feed.textxx.com/dir/files/feed/celxx.com/index.php"))
OR die ("Server is down for maintenance. Please try again later.");

My first guess is that the server in question is not configured to allow includes via http (only via the local file system).

Hello,

We are yet to get a response from our Host in regard to this.

Please let us know whether we could enable this ourself through a code in the .htaccess file or in a php.ini file.

What should be the code?

Where this file has to be placed [in the main directory of the domain or in the particular sub-directory]?

Some hosts do not allow url_fopen due to security reasons.

Kindly guide us as to what we should do in this regard.

Thanks,

Lakshmanan S.Hello,

We have just found a solution to this problem.

We are able to see the pages now by making use of the following PHP's cURL module function:

$ch = curl_init("http://feedxxx.com/index.php");
curl_exec($ch);
curl_close($ch);


Thanks for your help.

Lakshmanan S.If allow_ur_fopen is enabled, something as simple as this should work:

$data = file_get_contents('http://feedxxx.com/index.php');The reason that the include() failed is because it should; why would you try to include() a file across an http connection? Doesn't make sense.

Now, if you're simply trying to display/load the HTML output of a website, well, that certainly makes sense, though you should never use include/require for that...

Also, when posting PHP code, please use the board's bbcode tags - they make the code much, much easier to read (as well as aiding the diagnosis of syntax errors). You should edit your post now and add these bbcode tags to help others in reading/analyzing your code.
 
Back
Top