You are here: Re: Problem with Remote PHP includes « All PHP « IT news, forums, messages
Re: Problem with Remote PHP includes

Posted by Kim Andr Aker on 09/27/05 14:53

Nicola wrote:

> "Kim André Akerø" <kimandre@NOSPAMbetadome.com> wrote in message
> news:3psk24FbqrdpU1@individual.net...
> > Hobgoblin Music wrote:
> >
> > > My website is hosted by Demon. The PHP version is 4.3.5, and
> > > allow_url_fopen is set to on.
> > >
> > > This command:
> > >
> > > <?php include("http://www.mysite.com/file.htm"); ?>
> > >
> > > Fails every time, even though the same command, on the same page,
> > > works fine on a different server (which uses version 4.3.11).
> > >
> > > (I am using a .php extension on the page in question)
> > >
> > > I really need the same page to call up the same data on both
> > > sites, and the address has to be remote, so I can't use Server
> > > Side Includes.
> > >
> > > I've tried different URLS and file types (including .php files),
> > > but the Demon site will not run this command, although it copes
> > > fine with this:
> > >
> > > <?php include("../file.htm"); ?>
> > >
> > > Is there something obvious I have missed?
> > >
> > > (I can't make the path relative on one site and remote on the
> > > other, as I need to use exactly the same file on both sites).
> >
> > It appears that the "URL fopen wrappers" has been disabled by your
> > webhost.
> > http://php.net/function.include
> > http://php.net/ref.filesystem#ini.allow-url-fopen
> >
> > However, there are ways to work around this. Seeing as you're only
> > including a basic HTML file, and don't need any PHP functions from
> > the remote site, this example from the PHP manual might be right
> > for you: http://php.net/function.fsockopen#47845
>
> Thanks for the reply. I was hoping that "allow_url_fopen" being set
> to on would mean it ought to work.
>
> I'm afraid this is the first time I've tried to use PHP, and I can't
> see where to put the URL into the example you gave me:
>
> http://php.net/function.fsockopen#47845

When inserting that code into your PHP scripts, you're basically
setting up a user function, meaning that this snippet will essentially
work when the given example code is also in place:

<?php echo fetchURL("http://www.example.com/file.html"); ?>

--
Kim André Akerø
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация