zend-dom-query

Getting an element from PHP DOM and changing its value

房东的猫 提交于 2019-12-24 15:36:32
问题 I'm using PHP/Zend to load html into a DOM, and then I get a specific div id that I want to modify. $dom = new Zend_Dom_Query($html); $element = $dom->query('div[id="someid"]'); How do I modify the text/content/html displayed inside that $element div, and then save the changes to the $dom or $html so I can print the modified html. Any idea how to do this? 回答1: Zend_Dom_Query is tailored just for querying a dom, so it doesn't provide an interface in and of itself to alter the dom and save it,

How to Pass Array from Zend Dom Query Results to table

不打扰是莪最后的温柔 提交于 2019-12-11 09:55:03
问题 I am querying a URL for columns YEAR, RATING and I want to insert those two into a database. E.g. YEAR RATING 1992 9.2 2000 9 1999 8 . . . . . . . . So, I am writing script like: $url = 'BLA BLA '; $data = file_get_contents($url); $dom = new Zend_Dom_Query($data); $year = $dom->query('.secondaryInfo'); $rating = $dom->query('.ratingColumn'); How to insert both of them in a database??? for ( .... What do I have to write here?) $parse = new Application_Model_Parse(); $parse->createImdb(array(