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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.