> On Oct 23, 2006, at 1:31 PM, xercist_t2 wrote:
>
> > I am trying to use the php include code to load an external webpage
> > inside my own for things like an external message board and what not.
> > I am familiar with the php include script since I use them to include
> > header/menu files and what not but I cant seem to get it to work with
> > an external page. This is an example I am trying to use (using google
> > as the example web page):
> >
> > <?
> > include("http://www.google.com <http://www.google.com> ");
> > ?>
> >
> > is there any modifications to this code or another method I can look
> > at for doing this without having to resort to using frames?? Thx
The first thing you want to look at is the URL you add in the include() or
other statement. This is not an email address so there should not be a value
in angle braces as shown in your example.
Sometimes it is necessary to supply not only a URL but also a filename (such as
index.html) to create a FQDN.
Finally, if PHP is configured with allow_url_fopen set to off or 0, you will
not be able to reach out to other pages on the Internet. See the output of the
phpinfo() function or use ini_get() to determine the value of this parameter.
You may also want to look at alternate functions to use rather than include()
or require(). One example is http://php.net/readfile
The previous posts are correct, bringing in the entire content of a page like
the Google search form will give you a nested set of HTML, HEADER, and BODY
tags inside of your document body. Many browsers can handle it gracefully but
it sure won't pass any HTML or XHTML validations. If you are only trying to
get a Google search form, perhaps you can make your own form and post it to the
Google URL.
Keep in mind also that content you bring in will likely have relative URLS for
images and the action part of the FORM tag. As a result, they will fail to
work as expected without some trickery like a BASE HREF tag.
James Keeline
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/php-list/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/