Jump to content

Fetching an external page through javascript


Recommended Posts

Hi :)I'm currently making a PHP-script where I need javascript to do the "fetching"-part. With "Fetching", I mean getting an external page's code(HTML) into a Javascript variable, and eventually a file, that vil eventually be read by PHP :)Now, I've already tried some things, but they didn't work. I tried using this code, for instance: (it's only a part of it, but it's the "crucial bits :("window.frame['name'].document.documentElement.innerHTMLto fetch the info itself, together with<iframe name="name" src="a webpage"></iframe>However it only worked if the src in the iframe was on the same server as the script. How can I get javascript to fetch a page outside my server?Now, you might ask, why make Javascript do the fetching part? You see, at the page i'm fetching from, i have to be logged in. Javascript, being clientside, can to this, PHP, being server-side, cannot.Any ideas?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...