Hi all,
I'm looking to find a way to extract data from a table in an external website and store it in an SQL database. Can this be achieved using standard html/php/SQL or will I be required to code this as a seperate tool that runs locally alongside the website?
Any help/advice from people with experience in this field would be greatly appreciated!
Many thanks,
Nick
Extract data from external website using PHP
Moderator: General Moderators
-
minorDemocritus
- Forum Commoner
- Posts: 96
- Joined: Thu Apr 01, 2010 7:28 pm
- Location: Chicagoland, IL, USA
Re: Extract data from external website using PHP
The first thing that comes to mind is cURL. You'd have to find another library that allows you to pull table data out of the markup, though.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Extract data from external website using PHP
Just use the DOM to parse the HTML with DOMDocument::loadHTML. Then you can extract the table.
Re: Extract data from external website using PHP
Hey,
Thanks very much for the suggestions. I'm not massively familiar with DOMDocument and loadHTML. I've done a bit of research and looked in the php manual but still not sure I get it. Could anyone give me a quick description of how it should work in this instance?
Many thanks,
Nick
Thanks very much for the suggestions. I'm not massively familiar with DOMDocument and loadHTML. I've done a bit of research and looked in the php manual but still not sure I get it. Could anyone give me a quick description of how it should work in this instance?
Many thanks,
Nick
Re: Extract data from external website using PHP
Well, you could always try file_get_contents($url);