Want to load URL with PHP without loading it's contents?

Discussion in 'PHP' started by Seqqa, Jan 26, 2009.

  1. #1
    Same as the title basically...

    + rep for any help!
     
    Seqqa, Jan 26, 2009 IP
  2. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #2
    http://uk2.php.net/fopen

    fread some bytes if necessary. It will load the URL but not require your PHP script gets the contents.

    (If you meant without outputting, just use cURL/fgc.)
     
    Danltn, Jan 26, 2009 IP
  3. Seqqa

    Seqqa Well-Known Member

    Messages:
    3,695
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    115
    #3
    Which mode should I use? They all say open :confused:
     
    Seqqa, Jan 26, 2009 IP
  4. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #4
    Danltn, Jan 26, 2009 IP
  5. hassanahmad1

    hassanahmad1 Active Member

    Messages:
    150
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #5
    u can also use an html iframe for this
    like:
    
    echo "<iframe src=\"$website\" height='0' width='0'></iframe>";
    
    Code (markup):
     
    hassanahmad1, Jan 27, 2009 IP
  6. harrisunderwork

    harrisunderwork Well-Known Member

    Messages:
    1,005
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    135
    #6
    @OP Can you be please more precise, what you want to do with the url, so we can give the code exactly as required.
     
    harrisunderwork, Jan 27, 2009 IP
  7. Gangsta

    Gangsta Active Member

    Messages:
    145
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #7
    $fp = fsockopen ("www.example.com", 80, $errno, $errstr, 30);
    if (!$fp) {
        echo "$errstr ($errno)<br>\n";
    } else {
        fputs ($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\n\r\n");
        $content = fgets ($fp,128);
        fclose ($fp);
    }
    Code (markup):
    something like this
     
    Gangsta, Jan 27, 2009 IP