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 Quote 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'; ?> Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.