simpledom

I can't grab specific URL in search page

北城余情 提交于 2019-12-25 00:23:33
问题 I enter the estate website and searched by name of the city. After that I want to grab Osaka City building URL. In here http://brillia.com/search/?area=27999   There are four of those.   And I m using that link to grab URL. $allDivs = $parser->getElementsByTagName('div'); foreach ($allDivs as $div) { if ($div->getAttribute('class') == 'boxInfomation') { $allLinks = $div->getElementsByTagName('a'); foreach ($allLinks as $a) { $linkler[] = $a->getAttribute('href'); } } } But I cant grab those.

How does one use SimpleDOM sortedXPath to sort on node value?

て烟熏妆下的殇ゞ 提交于 2019-12-11 13:34:10
问题 XML newbie here! I have a file containing only the following XML: <tags> <tag>orange</tag> <tag>apple</tag> <tag>banana</tag> </tags> I want to ouput the tags alphabetically. I am trying to use SimpleDOM library and its sortedXPath method. Here's what I have so far, which outputs the tags unsorted. $allTags = simpledom_load_file("tags.xml"); foreach ($allTags->sortedXPath("//tags/tag", "tag") as $i => $item) { echo($item); } Could someone tell me how to write this correctly so it works?

PHP Simple HTML DOM Parser returns gibberish

北城以北 提交于 2019-12-11 08:58:42
问题 $html = file_get_html('http://www.livelifedrive.com/'); echo $html->plaintext; I've no problem scraping other websites but this particular one returns gibberish. Is it encrypted or something? 回答1: Actually, the gibberish you see is a GZIPed content. When I fetch the content with hurl.it for instance, here are the headers returned by server: GET http://www.livelifedrive.com/malaysia/ (the url http://www.livelifedrive.com/ resolves to http://www.livelifedrive.com/malaysia/) Connection: keep

Simple HTML DOM code issue

三世轮回 提交于 2019-12-08 05:13:01
问题 I'm working on a page that gets html div code to my website page and displays on the website. My code goes like this: require './simpledom.php'; $url = 'https://cit2.net/index.php?topic=75443.0'; $html = file_get_html($url); if (!empty($html)) { $element = $html->find('div[id=msg_783326]'); if (!empty($element)) { echo $element; } } It won't show a thing where as the link contains things in it. I want it to show the specific div in that page in my website page. What should I do/edit in my

Adding a block of XML as child of a SimpleXMLElement object

流过昼夜 提交于 2019-12-03 20:27:20
问题 I have this SimpleXMLElement object with a XML setup similar to the following... $xml = <<<EOX <books> <book> <name>ABCD</name> </book> </books> EOX; $sx = new SimpleXMLElement( $xml ); Now I have a class named Book that contains info. about each book. The same class can also spit out the book info. in XML format akin the the above (the nested block).. example, $book = new Book( 'EFGH' ); $book->genXML(); ... will generate <book> <name>EFGH</name> </book> Now I'm trying to figure out a way by

php , simple_html_dom.php, get selected option

巧了我就是萌 提交于 2019-12-02 19:13:15
问题 I have a html block like this : $localurl = ' <select name="cCountry" id="cCountry" style="width:200" tabindex="5"> <option value="251">Ascension Island</option> <option selected="selected" value="14">Australia</option> <option value="13">Austria</option> '; I'm trying to extract the selected value in this case "Australia" using simple_html_dom ( http://simplehtmldom.sourceforge.net/ ). So far I have build a function but is not working : //extract the selected value function getValue_selected