adam_ Posted December 1, 2006 Share Posted December 1, 2006 HiI have a PHP driven CMS (self coded), for a group of users of a particular piece of software. The software writes information about the user (eg time logged in) etc to a website that is out of my control. I want to be able to grab this data (which is displayed publically on a website) and put it into my MySql database once a week, as a cron job.I can use cron and mysql fine, the issue is I have no idea how to go about grabbing data from another website.I consider myself in the intermediate/semi-adavanced level with PHP, so a link to a tutorial would be great, i dont need the code making for me.As the software is pre-release, i do not want to post it, or the website in question so the forum, but a generic response on the subject would be appreciated.ThanksAdam_ Quote Link to comment https://forums.phpfreaks.com/topic/29112-using-php-to-grab-data-from-another-webpage/ Share on other sites More sharing options...
Jocka Posted December 1, 2006 Share Posted December 1, 2006 the file command would come in handy here. If the information is posted on the page as you say then you can use file to read the page and sort it as it needs to be. Quote Link to comment https://forums.phpfreaks.com/topic/29112-using-php-to-grab-data-from-another-webpage/#findComment-133440 Share on other sites More sharing options...
Psycho Posted December 1, 2006 Share Posted December 1, 2006 Just because data is publicly available does not mean it is legal to copy it. I will leave it to you to verify wether that site allows you to do that or not.What you are wanting to do is called screen scraping. Do a search for "PHP .creen scraping". There are free classes you can download to do all the heavy lifting. Quote Link to comment https://forums.phpfreaks.com/topic/29112-using-php-to-grab-data-from-another-webpage/#findComment-133512 Share on other sites More sharing options...
keeB Posted December 1, 2006 Share Posted December 1, 2006 Or, you can use the web wrapper for fopen() to retrieve the HTML and parse the relevant parts.http://us2.php.net/fopenGood luck, let me know if you have any issues. Quote Link to comment https://forums.phpfreaks.com/topic/29112-using-php-to-grab-data-from-another-webpage/#findComment-133524 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.