I managed to get the HTML code from the site using HTMLDomParser ( http://simplehtmldom.sourceforge.net/ ):
$html = HtmlDomParser::file_get_html('https://example.com/id=1');
The result is the following HTML:
<p> ANDE 2, the Atmospheric Neutral Density Experiment 2, is a pair of microsatellites (Castor and Pollux) launched from Cape Canaveral on STS 127 on 15 July 2009 at 22:03 UT and deployed from the payload bay of the shuttle on 30 July 2009 at 17:22 UT.</p>
<p><strong>Launch Date:</strong> 2009-07-15<br/><strong>Launch Vehicle:</strong> Shuttle<br/><strong>Launch Site:</strong> Cape Canaveral, United States<br/></p>
Run codeHide resultI want to try to make this HTML code and save it in mySQL database. So, in the database I will have four columns:
- Description
- Launch date
- Launch vehicle
- Website launch
HTML layout will always remain the same. My other database contains id
for URL. I can replace it id=1
with a variable, so I can save some web page data.
The only thing I'm worried about if it id
doesn't exist. Is it possible to simply skip this page if it cannot find the HTML code it is looking for?
, . ?
, DomParser .
: , , - , .
EDIT 2: : , , HTML, HTMLDomParser ( "", "" ..) , . , , HTML?
3: /, , . -, HTML .