SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    including html files in php

    Is there a way to include the content from an external link?
    for example:

    if i was making a completely php site and i wanted to use my guestbook that is being hosted by...... hmm... Lpage (is it still around?). anyway, could it be done? could i include the content from the guestbook in the php file? i dont wanna use frames. I cant get include to work, so i can assume you cant but i am asking anyway.

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You absolutely can. Can you give us the exact code you've been using? This should work:
    PHP Code:
    <?php
    include("http://www.guestbooklocation.com/");
    ?>
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    While I'm not familiar with the mechanics of PHP, I thought it would be worthwhile to mention that you should probably strip out the undesirables in the page you are snagging, like the <html> start and end tags, as well as the <head>.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well aes. i used exactly that but it gave me an error.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heres the exact error when i wanted it to include yahoo.com (test):


    Warning: Failed opening 'http://www.yahoo.com/' for inclusion (include_path='') in c:\windows\desktop\server\index2.php on line 76

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    therunes,

    Your code would work fine if you were running the script on a unix platform. Unforunately on a windows platform you cannot include external pages through HTTP. It isn a bug in PHP and I have no idea if they even plan to fix it. But your code WILL work on a unix platform.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so if i uploaded it to my webspace (linux) it would work. it wont work on my apache for windows (test platform)?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •