Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Simple Question

  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple Question

    I do not know PHP and while I would love to learn it some day I do not have the time to do so right now. I did a little searching for this question and found nothing. Question:

    Is there a way to create a php file which will display whatever URL I specify in it? Not a redirection like I already know how to achieve with HTML. I want this php file to display the contents of whatever URL I plug into it. Is this possible?

    Please note iframes are not acceptable as they are currently only supported by IE. I need something that will work with the top three to four browsers available today.

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There's no simple way to do this as far as I know. You can include() a url if url wrappers are open in the PHP ini, but then unless the page you include uses absolute url's for every link and image therein it will look pretty broken. For instance, if you did:
    PHP Code:
    <?php
    include_once("http://www.google.com");
    ?>
    You will see what I mean, you get the basic page layout but the images are missing and if you try and do a search, because the link is relative to the server the page is on, it will break.

    The only way I can think to do this is to use some kind of regex to parse the entire page and to re-write all the links so that they're absolute rather than relative, but that's a lot more complex a solution that you wanted I guess.

  • #3
    Banned
    Join Date
    Nov 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    find out about the window frames technology.

  • #4
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Mulsiphix
    Please note iframes are not acceptable as they are currently only supported by IE. I need something that will work with the top three to four browsers available today.
    o.O What are you smoking? Last I checked iframes were supported by most browsers.

  • #5
    Regular Coder
    Join Date
    Apr 2004
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I wouldnt suggest using that include_once not exactly the smartest thing to do and I dont think you will be able to regex it why not use fsockopen so then you have it in a string then can make sure pages display correctly. An example

    PHP Code:
    <?php
    $fp 
    fsockopen("www.example.com"80$errno$errstr30);
    if (!
    $fp) {
       echo 
    "$errstr ($errno)<br />\n";
    } else {
       
    $out "GET / HTTP/1.1\r\n";
       
    $out .= "Host: www.example.com\r\n";
       
    $out .= "Connection: Close\r\n\r\n";

       
    fwrite($fp$out);
       while (!
    feof($fp)) {
           echo 
    fgets($fp128);
       }
       
    fclose($fp);
    }
    ?>
    From the Manual.

  • #6
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This also messes up the display. Is there any way of using fsockopen() and not having all links relative?


  •  

    Posting Permissions

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