简体   繁体   中英

How to scrape info From a Website into an HTML Doc

I want To get info From a website like in 24timezones.com I want just the numbers of the time (Just For example not going to use https://24timezones.com ) How do I get this info and Save it in variables in my HTML DOC.

I would like it if you provided Some code samples.

Thanks in Advance.

It is pretty easy with This PHP web scraper.
just use it as

<?php
// Create DOM from URL or file
$html = file_get_html('http://www.google.com/');

// This will find all images you can exchange 'img' with any type of html tag like 'a', 'div', etc. 
foreach($html->find('img') as $element){
       echo $element->src . '<br>';
}

// or you can just get an item using its id
$html->find('div#root', 0)->innertext;

// Dump contents (without tags) from HTML
echo file_get_html('http://www.google.com/')->plaintext;

See this short example:- syedd.xp3.biz

It is just for example And it shows the time of New York

Download the latest version of it from here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM