1

I want to grab static data from different website (URL and elements name provided), what's the easiest way?

www.address/articles/grab-this

<html> (...) <article id="#article-121"> <h1>Header</h1> <p>Contents</p> </article> (...) </html> 

index.php

/* Grab "#article-121" from www.address/articles/grab-this */ <article id="#article-121"> <h1>Header</h1> <p>Contents</p> </article> /* Close the connection */ 
2
  • duplicated search parse html php Commented Jul 25, 2011 at 12:57
  • possible duplicate of Best methods to parse HTML with PHP Commented Jul 25, 2011 at 13:02

1 Answer 1

2
$contents = file_get_contents(url_goes_here); 
Sign up to request clarification or add additional context in comments.

2 Comments

This is a great answer, but I guess getting exact element based on ID is much more harder?
Yes, that is true. Once you have the $contents you should be able to manipulate/parse it

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.