muppet77 Posted August 18, 2016 Share Posted August 18, 2016 Hi, I am trying to grab some data from a site, but my blocker at the moment is that the site has a button near the end of the page, that opens up more data. It's th ebutton that says "Show All" Using file get contents, I don't get this "hidden data". Any ideas please? I'm a novice and am using this code: echo strip_tags(file_get_contents("http://www.sportinglife.com/football/live/vidiprinter")); Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/301930-file_get_contents-doesnt-get-everything/ Share on other sites More sharing options...
PravinS Posted August 18, 2016 Share Posted August 18, 2016 file_get_contents() function will return just a page content (view source), it will not execute any javascript or AJAX code, and "Show All" button is providing AJAX based data Quote Link to comment https://forums.phpfreaks.com/topic/301930-file_get_contents-doesnt-get-everything/#findComment-1536295 Share on other sites More sharing options...
Jacques1 Posted August 18, 2016 Share Posted August 18, 2016 Forget about the main page and use the URL http://www.sportinglife.com/football/live/vidiprinter/all/ It provides a machine-friendly JSON representation of the data. In any case, make sure that scraping the website doesn't violate the terms of service. There may also be an official API where you can get the data from. Quote Link to comment https://forums.phpfreaks.com/topic/301930-file_get_contents-doesnt-get-everything/#findComment-1536297 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.