nlandstrom Posted April 10, 2012 Share Posted April 10, 2012 Hi, I am quite new to PHP and to learn more about it I decided I would make a little project to easy my life a little bit I want to make a site that fetches lunch menus from the restaurants nearby my work. I would just like some help getting pointed in the right direction on how to make this happen Thanks! Br, Niklas Quote Link to comment Share on other sites More sharing options...
dcro2 Posted April 10, 2012 Share Posted April 10, 2012 Let me google that for you, and that. Quote Link to comment Share on other sites More sharing options...
nlandstrom Posted April 10, 2012 Author Share Posted April 10, 2012 Thanks, I havent read all about these two links yet, but will they help me fetch specific data and insert to my own mysql db? So I dont have to send a request to the server each time I browse the page? Thanks again. Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted April 10, 2012 Share Posted April 10, 2012 So you want to take their content, store it yourself to display. Most websites frown on this and consider it theft, while others may allow you to do this. It's best to ask their permission before starting this. But if you do have permission.... Need a way to connect to the site and obtain some data so look into: dom, simplhtmldom, curl, file_get_contents(), simplexml Some of the ways above can get specific data from tags on a page, others must find the content using regex, with preg_match(), preg_match_all() Once you have the desired content, is best to filter and escape bad characters, you may run into different character encoding Then you insert the data into mysql in whatever database design you came up with, then fetch/select the data you want to display. http://www.php.net/manual/en/ref.mysql.php Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 10, 2012 Share Posted April 10, 2012 I have to say this seems like the kind of project that would be way more trouble than it is worth. Each restaurant will have their menu in a very different format, and you only use each format one time. It would be easier to just grab the page and save it on your computer maybe as a PDF or .html, rather than writing the code to scrape each page and save it in a DB. What do you plan to do with the data once you have it that makes this worth while? Quote Link to comment 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.