mjahkoh Posted August 16, 2011 Share Posted August 16, 2011 I'm using the "PHP Simple HTML DOM Parser" - http://simplehtmldom.sourceforge.net/manual.htm I'm running through a bunch of elements and I need to change to change This <div class="tpsobivc_doted"></div> To this <div class="tpsobivc_doted" id="tpsobivc_doted"></div> Regards Jackson Link to comment https://forums.phpfreaks.com/topic/244905-use-simple-html-dom-parser-to-append-id-of-div/ Share on other sites More sharing options...
phpSensei Posted August 16, 2011 Share Posted August 16, 2011 My memory of Simple Html Dom is vague. Try <?php $html = file_get_html('http://www.somesite.com'); # I assume its from a url not a string, otherwise use str_get_html $div = $html->find('div[class=tpsobivc_doted]'); $div->id = 'topic_solved'; ?> Link to comment https://forums.phpfreaks.com/topic/244905-use-simple-html-dom-parser-to-append-id-of-div/#findComment-1258041 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.