Bạn đang xem: Php simple html dom parser
require("simple_html_dom.php");$html = file_get_html("https://example.com");$ret = array();foreach($html->find(".project-card-mini-wrap") as $element) echo $element; The output đầu ra of $element is:
Hopefully this will provide some insight to lớn you as well as other users of PHP Simple HTML DOM Parser
foreach($html->find(".project-card-mini-wrap") as $element) echo "Project name: ",$element->find(".project_name",0)->innertext," "; echo "Image source: ",$element->find("img",0)->src," "; echo "Link: ",$element->find("a",0)->href," ";Produces this output:
Project name: KOSTIREV - THE REAL YOU Image source: https://ksr-ugc.imgix.net/projects/2123706/photo-original.png?v=1444253259&w=218&h=162&fit=crop&auto=format&q=92&s=9d6c437e96b720dce82fc9b598b3e8aeLink: /projects/andrewkostirev/kostirev-the-real-you
I tried this & it worked, thanks for the help! Here is something i made using primewire.ag as a example.... The goal here was to extract all the liên kết of a given page.
Xem thêm: regex php
find(".movie_version_link") as $linkClass) echo "Link: ",$linkPrefix,$linkClass->find("a",0)->href,"
This is also a good library for scraping và traversing via HTML
Thanks for contributing an answer lớn Stack Overflow!Please be sure khổng lồ answer the question. Provide details & share your research!
But avoid …Asking for help, clarification, or responding to lớn other answers.Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Post Your Answer Discard
Not the answer you're looking for? Browse other questions tagged php html dom or ask your own question.
site thiết kế / hình ảnh sản phẩm © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. Rev2021.12.3.40888