Retrieve data contained a certain span class

前端 未结 3 1401
故里飘歌
故里飘歌 2021-01-25 14:52

using file_get_contents, I open an Internet URL and get the contents of this webpage.

Inside the HTML there are many identical span class tags:

<         


        
3条回答
  •  日久生厌
    2021-01-25 15:18

    You can parse this content using the DOMDocument class that is provided in PHP. Once you load the content into the dom document you can then filter out the span tags by using $content->getElementsByTagName('span'); Once you have done this then you can filter the results by the tags attributes and get the content.

提交回复
热议问题