1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Rep Power

    Trying to use PHP to bypass the iFrame 'Same Origin Policy'


    I'm working on a project where I would like to load the contents of one webpage (that I'm not hosting) into a webpage that I am hosting with the ability to access the DOM of the non-hosted page.

    If anyone has any advice as to whether it's possible to achieve this, I'd love to hear some feedback. Maybe PHP isn't even the answer. Maybe I'm going about this all wrong. I'm definitely open to any suggestions at this point!

    Thanks for reading,
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Pennsylvania, USA
    Rep Power
    You won't be able to iframe this or any other method, those security policies are there for a reason and they're written by people with a lot more skill than you (and access to the underlying browser code, which you cannot see).

    You can:

    A) Write a browser plugin which alters the GUI you're using for this, similar to Reddit Enhancement Suite.

    B) Use PHP to pass through everything on the back end, dynamically rewriting it and serving it as though it's native content. This will be slow to execute since it requires 2 round trips instead of 1. There's a free proxy (I want to say ProxyDevil) which will help get you started with this.

    C) Gain access to the source code of the UI you're talking about and modify it directly.

    D) See if the system has an API with which you can make these calls, then write your own front-end, ignoring the GUI and making a SOA front-end of your own design, all in PHP.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo