How can I set the value of a PHP variable to be the HTML OUTPUT of another page into a PHP variable?
For example I can get TWEETS directly as a JSON object from Twitter by going to a user’s URL. But rater than use AJAX, I would like to just include the data directly into my page as it’s being built by my PHP script. This would be a piece of cake if I could get the output of said URL directly into a PHP variable,in other words:
Maybe, but cURL always works, and file_get_contents can be locked down to not get external content on some web servers. So it is always good to recommend either
I found simplexml_load_file the other day after a search. It’s also another way. Use libxml_use_internal_errors() to supress the errror (although worth looking at. Saves going to w3c validator!)
If you’re used to a bit of XML it’s quite useful.