Remove footer from iframe

Discussion in 'PHP' started by assasinkilla, Sep 12, 2009.

  1. #1
    Hello, I have an iframe in my site, But I want to remove the footer, since that ads bother a lot to my users, its there anyway? Reducing the frame will not help, since the size varies on the day and time, so I will have to change it constantly.

    If there is any way, please tell me, and if I have to hire someone, I will maybe do.

    Thanks
     
    assasinkilla, Sep 12, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If the iframe is from another domain, you cannot do a thing.. You could try adding security="restricted" to disable javascript in the iframe but this only works in IE. Or you could create a scraper in PHP that will fetch the page and remove the footer HTML, then save it locally on your system and update every X minutes. Ofcourse, that all doesn't sound very nice, using the other person's website content without showing his ads.
     
    premiumscripts, Sep 12, 2009 IP
  3. assasinkilla

    assasinkilla Guest

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Can you talk me more about the scrapper thing please?

    I got this code also
    <?
    $headers = "GET /site HTTP/1.0\r\nUser-Agent: name plugin/1.0\r\n\r\n";
    $fp = fsockopen("www.site.com", 80, $errno, $errmsg, 30);
    if($fp) {
    fwrite($fp, $headers);
    $resp="";
    while(!feof($fp)) {
    $resp .= fgets($fp, 1024);
    }
    fclose($fp);
    $neck = strpos($resp,"\r\n\r\n");
    $head = substr($resp,0,$neck);
    $body = substr($resp,$neck+4);
    print $body;
    }
    ?>

    And the footer is included in $body, how can I remove the footer?


    THANKS!!
     
    assasinkilla, Sep 12, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Instead of all that you should just use file_get_contents($url) , process it, then save it to disk with file_put_contents (PHP 5..) You'll have to use a regex to remove the part you want with preg_replace.
     
    premiumscripts, Sep 13, 2009 IP