1

I have a simple PHP script that needs to parse the content of another webpage. What is the easiest way to put the HTML code into a PHP variable?

3
  • what have you tried? looking e.g. here: stackoverflow.com/questions/3885760/… should give you some starting info Commented Sep 6, 2012 at 7:27
  • I've looked into CURL, but I've spent a few hours with it, and it seems unnecessarily complex. Commented Sep 6, 2012 at 7:29
  • see, that's the info that you should put into the question ;) Commented Sep 6, 2012 at 7:30

1 Answer 1

2

In your php script:

$html = file_get_contents('http://yourUrl.com');
echo $html;

If you need more advanced functionality, like simulating Headers/Cookies, look into - cURL.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.