Is it possible to check for iframe with PHP?

Discussion in 'PHP' started by merkato, Dec 10, 2006.

  1. #1
    Is it possible to check if my website is in an iframe, using PHP?
     
    merkato, Dec 10, 2006 IP
  2. TVCokeCan

    TVCokeCan Peon

    Messages:
    1,208
    Likes Received:
    147
    Best Answers:
    0
    Trophy Points:
    0
    #2
    As far as I KNOW in php, No. However you can breaK out of a Iframe

    
    <script language="Javascript"> 
    <!-- 
    if (top.location!= self.location) { 
    top.location = self.location.href 
    } 
    //--> 
    </script> 
    Code (markup):
     
    TVCokeCan, Dec 10, 2006 IP
  3. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Remember php runs on the server and once it has sent the page to the browser it no longer has any control. The request would look the same to php / your server with or without an iframe.
     
    matthewrobertbell, Dec 10, 2006 IP
  4. daboss

    daboss Guest

    Messages:
    2,249
    Likes Received:
    151
    Best Answers:
    0
    Trophy Points:
    0
    #4
    1. do a fsockopen or a file_get_contents
    2. read the content of the url into a string
    3. parse the string for iframes

    simple enough? ;)
     
    daboss, Dec 10, 2006 IP
  5. merkato

    merkato Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    But I wouldn't know the URL of the page. Anybody could be iframing.
     
    merkato, Dec 10, 2006 IP
  6. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #6
    If you can get the website thats framing you with javascript, store it in a cookie, reload and mail it.

    Peace,
     
    Barti1987, Dec 10, 2006 IP
  7. merkato

    merkato Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thats the what I'm asking. Can I find out the website that is iframing me with PHP, not JS.
     
    merkato, Dec 10, 2006 IP
  8. merkato

    merkato Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Nobody really knows how to do this?
     
    merkato, Dec 10, 2006 IP
  9. Pat Gael

    Pat Gael Banned

    Messages:
    1,331
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #9
    As far as I know it can only be done echoing the javascript input so it has no sense at all.
     
    Pat Gael, Dec 10, 2006 IP
  10. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Yep. As has been mentioned directly and indirectly, it's not possible to do this with PHP only.
     
    TwistMyArm, Dec 11, 2006 IP