How to scrape info From a Website into an HTML Doc

I want To get info From a website like in I want just the numbers of the time (Just For example not going to use 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.

1 answer

  • answered 2021-06-10 11:00 Ɗααɳιടԋ Sყҽԃ

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

    // Create DOM from URL or file
    $html = file_get_html('');
    // 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('')->plaintext;

    See this short example:-

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

    Download the latest version of it from here