Jump to content

pull html content and style from other website


doron447

Recommended Posts

Hi,

I'm trying to find a way to which I could pull content and style from array of website's.

In simple words, I want to use commands such as:
document.getElementById("somename")

on specific url and not on my webpage.

Can I do that?
Incase not, what method should I use?

Thank you,

Doron

It is frowned upon to steal from other sites...

 

But, anyway, your best guess is PHP - $othersite = file_get_contents("http://someurl.com"); would copy the contents of the source code into the variable $othersite.

 

If you cannot use PHP, use document.documentElement.innerHTML.toString() in JavaScript, that'd give you the entire head and body content of the site, though you'd might need to check for any attributes on the documentElement if they are relevant to the site flow (like, if its dir attribute it rtl and not ltr, or the lang is something other than en).

 

Once again, stealing stuff from other sites is frowned upon. Don't do it.

Examples above are just for documentation purpose, I do not condone any misconduct...

If he wanted to do it manually, he could just go to the site and use file->save as, no need to fiddle around in the js console trying to extract the html.

 

For what he wants, he will need to use something like PHP to download the URL content and then extract the data.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.