title: How to strip all the code from a string in PHP?
body: <p>I have the following html page saved in a variable after scrapping a website:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" &gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt; &lt;head&gt; &lt;!-- HTTP 1.1 --&gt; &lt;meta http-equiv="Cache-Control" content="no-store"/&gt; &lt;!-- HTTP 1.0 --&gt; &lt;meta http-equiv="Pragma" content="no-cache"/&gt; &lt;!-- Prevents caching at the Proxy Server llllll --&gt; &lt;meta http-equiv="Expires" content="0"/&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt; &lt;meta name="author" content="Ministerul Finantelor Publice"/&gt; &lt;link rel="icon" href="/images/favicon.ico"/&gt; &lt;link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/&gt; &lt;script type="text/javascript"&gt;&lt;!-- var nVer = navigator.appVersion; var nAgt = navigator.userAgent; var browserName = navigator.appName; var fullVersion = ''+parseFloat(navigator.appVersion); var majorVersion = parseInt(navigator.appVersion,10); var nameOffset,verOffset,ix; // In MSIE, the true version is after "MSIE" in userAgent if ((verOffset=nAgt.indexOf("MSIE"))!=-1) { browserName = "Microsoft Internet Explorer"; fullVersion = nAgt.substring(verOffset+5); } // In Opera, the true version is after "Opera" else if ((verOffset=nAgt.indexOf("Opera"))!=-1) { browserName = "Opera"; fullVersion = nAgt.substring(verOffset+7); } // In Chrome, the true version is after "Chrome" else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) { browserName = "Chrome"; fullVersion = nAgt.substring(verOffset+9); } // In Safari, the true version is after "Safari" //else if ((verOffset=nAgt.indexOf("Safari"))!=-1) { //browserName = "Safari"; // fullVersion = nAgt.substring(verOffset+8); //} // In most other browsers, "name/version" is at the end of userAgent else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) &lt; (verOffset=nAgt.lastIndexOf('/')) ) { document.write('&lt;'+'link rel="stylesheet" type="text/css" media="all" href="/styles/andreas01/themeDefault.css" /&gt;'); } else{ document.write('&lt;'+'link rel="stylesheet" type="text/css" media="all" href="/styles/andreas01/themeDefault.css" /&gt;'); } // trim the fullVersion string at semicolon/space if present if ((ix=fullVersion.indexOf(";"))!=-1) fullVersion=fullVersion.substring(0,ix); if ((ix=fullVersion.indexOf(" "))!=-1) fullVersion=fullVersion.substring(0,ix); majorVersion = parseInt(''+fullVersion,10); if (isNaN(majorVersion)) { fullVersion = ''+parseFloat(navigator.appVersion); majorVersion = parseInt(navigator.appVersion,10); } document.write('&lt;'+'link rel="stylesheet" type="text/css" media="all" href="/styles/andreas01/theme'+browserName+majorVersion+'.css" /&gt;'); --&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" media="print" href="/styles/andreas01/print.css" /&gt; &lt;script type="text/javascript" src="/scripts/prototype.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/scripts/scriptaculous.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/scripts/global.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-2298641-2']); _gaq.push(['_trackPageview']); _gaq.push(['_trackPageLoadTime']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); &lt;/script&gt; &lt;title&gt;&lt;/title&gt; &lt;meta name="description" content=""/&gt; &lt;meta name="keywords" content=""/&gt; &lt;/head&gt; &lt;body style="background-color:#ffffff"&gt; &lt;div id="page" &gt; &lt;div id="header" class="clearfix"&gt; &lt;form name="licitatiiForm" method="post" action="/acasa.html"&gt; &lt;input type="hidden" name="pagina" value="cauta"&gt; &lt;!DOCTYPE html&gt; &lt;script type="text/javascript"&gt; var min=8; var max=18; function increaseFontSize() { var p = document.getElementsByTagName('p'); for(i=0;i&lt;p.length;i++) { if(p[i].style.fontSize) { var s = parseInt(p[i].style.fontSize.replace("px","")); } else { var s = 12; } if(s!=max) { s += 1; } p[i].style.fontSize = s+"px" } } function decreaseFontSize() { var p = document.getElementsByTagName('p'); for(i=0;i&lt;p.length;i++) { if(p[i].style.fontSize) { var s = parseInt(p[i].style.fontSize.replace("px","")); } else { var s = 12; } if(s!=min) { s -= 1; } p[i].style.fontSize = s+"px" } } &lt;/script&gt; &lt;img style="position:relative;margin-left:0px auto; margin-right: 0px auto; top:20px; float:left;" height="130" width="987" src="/styles/andreas01/images/banner.jpg" usemap="#home" /&gt; &lt;map name="home"&gt; &lt;area shape="circle" coords="70,61,49" alt="Acasa" href="/acasa.html?method=inceput&amp;pagina=acasa" /&gt; &lt;!--&lt;area shape="rect" coords="650,80,850,120" style="border-color: red" alt="Eveniment" href="/event.html" /&gt;--&gt; &lt;/map&gt; &lt;div id="event"&gt; &lt;/div&gt;  &lt;!--&lt;div id="cauta"&gt;&lt;a href="/harta.html"&gt;Hart&amp;#259;&lt;/a&gt;&lt;/div&gt;--&gt; &lt;div id="cauta"&gt; |&lt;a href="/harta.html"&gt;Hart&amp;#259; site&lt;/a&gt; |C&amp;#259;utare &lt;input type="text" name="cauta" value="" style="width:70px ;height:10px"&gt; &lt;a href="javascript:decreaseFontSize();"&gt; &lt;span style="text-decoration: none"&gt;&lt;img src="/images/a_mic.gif"/&gt;&lt;/span&gt;&lt;/a&gt; &lt;a href="javascript:increaseFontSize();"&gt; &lt;span style="text-decoration: none"&gt;&lt;img src="/images/A.gif"/&gt;&lt;/span&gt;&lt;/a&gt;&lt;br&gt;   &lt;br&gt;    &lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;span style="text-decoration: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; &lt;a href="http://www.facebook.com/mfpromania" target="_blank"&gt; &lt;img src="/images/facebook.png"/&gt;&lt;/a&gt;   &lt;a href="https://twitter.com/ro_mfp" target="_blank"&gt; &lt;img src="/images/twitter.png"/&gt;&lt;/a&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;div id="desp" align="center"&gt; &lt;div id="vista_toolbar"&gt; &lt;ul&gt; &lt;li&gt;&lt;a class="acasa2" href="/acasa.html?method=inceput&amp;pagina=acasa"&gt;&amp;nbsp;Acas&amp;#259;&amp;nbsp;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/echipa.html?pagina=domenii"&gt;Domenii de activitate&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/ueprezentare.html?&amp;pagina=ue"&gt;Afaceri Europene&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/prezentare.html?&amp;pagina=stabilitate"&gt;Stabilitate financiar&amp;#259;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/execbug.html?pagina=buletin"&gt;Buletin MFP&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="contact2" href="/acasa.html?method=comunicate&amp;pagina=presa&amp;locale=ro"&gt;Presa&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="content" class="clearfix"&gt;&amp;nbsp; &lt;br /&gt; &lt;font size="0.8em"&gt; &lt;/font&gt; &lt;div &gt; &lt;table align="right" &gt; &lt;tr&gt; &lt;td&gt; &lt;div id="sub_acasa"&gt; &lt;a href ="http://www.transparenta-bugetara.gov.ro/" target="_blank"&gt; &lt;img src="/images/TRANSPARENTA.jpg"&gt;&lt;/a&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="sub_acasa"&gt; &lt;img src="/styles/andreas01/images/interes.jpg" &gt; &lt;br&gt; &lt;a href ="/prioritatistrategice.html?pagina=prioritatistrategice"&gt;Priorit&amp;#259;&amp;#539;i strategice &amp;#537;i planuri de ac&amp;#539;iuni ale MFP &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/programDeConvergenta.html?pagina=programConvergenta"&gt;Program de convergen&amp;#355;&amp;#259; &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/pachete.html?pagina=pachete" &gt;Pachet finan&amp;#355;are extern&amp;#259; &lt;/a&gt; &lt;br&gt; &lt;hr /&gt; &lt;a href ="/certificateemisiigaze.html?pagina=certificateemisiigaze" &gt;Certificate de emisii gaze cu efect de ser&amp;#259; &lt;/a&gt; &lt;br&gt; &lt;hr /&gt; &lt;img src="/images/engl.jpg"&gt;&amp;nbsp;&amp;nbsp;&lt;a href ="/trezorengl.html?pagina=domenii" &gt;Treasury and Public &lt;br&gt;Debt &lt;/a&gt; &lt;br&gt; &lt;hr /&gt; &lt;img src="/images/rom.jpg"&gt;&amp;nbsp;&amp;nbsp;&lt;a href ="/rapoarteMFP.html?pagina=domenii" &gt;Trezorerie &amp;#351;i datorie &lt;br&gt;public&amp;#259; &lt;/a&gt; &lt;hr /&gt; &lt;a href ="/noutatiLegislative.html?pagina=domenii" &gt;Nout&amp;#259;&amp;#355;i legislative &lt;/a&gt; &lt;hr /&gt; &lt;a href ="/pdfbuget.html?pagina=acasa" &gt;Bugetul MFP &lt;/a&gt; &lt;hr /&gt; &lt;a href ="reformabugue.html?pagina=domenii" &gt;Bugetul UE &lt;/a&gt; &lt;br&gt; &lt;hr /&gt; &lt;a href ="/sec.html?pagina=acasa" &gt;Certificat atestare SEC &lt;/a&gt; &lt;br&gt; &lt;/a&gt; &lt;br&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;!-- &lt;tr&gt; &lt;td&gt; &lt;div id="sub_acasa"&gt; &lt;a href ="/oportunitatiangajare.html?pagina=acasa"&gt; &lt;img src="/images/oprtunitatiangajare.jpg"&gt;&lt;/a&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; --&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="sub_acasa"&gt; &lt;a href ="/publicatiipresa.html?pagina=presa"&gt; &lt;img src="/images/revista.jpg"&gt;&lt;/a&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="sub_acasa"&gt; &lt;a href ="/ghiduriilustrate.html?pagina=acasa"&gt; &lt;img src="/images/ghiduriulustrate.jpg"&gt;&lt;/a&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;!-- &lt;div id="sub_acasa"&gt; &lt;a href ="/prezentari2016.html?pagina=acasa"&gt; &lt;img src="/images/prezentari.jpg"&gt;&lt;/a&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="sub_acasa"&gt; &lt;a href ="/loteriabonurilor.html?pagina=loteriabonurilor"&gt; &lt;img src="/images/loteriabonurilor.jpg"&gt;&lt;/a&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;--&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="sub_acasa"&gt; &lt;a href ="/telverde.html?pagina=telverde"&gt; &lt;img src="/images/telverde.jpg"&gt;&lt;/a&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="sub_acasa"&gt; &lt;img src="/styles/andreas01/images/agenti.jpg"&gt; &lt;br&gt; &lt;a href ="/ghidajstat.html?pagina=domenii"&gt; Ajutor de stat &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/publicitateinselatoareForm.html?pagina=acasa"&gt; Publicitate &amp;#206;n&amp;#351;el&amp;#259;toare &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/datoriaguv.html?pagina=domenii"&gt; Ghidul investitorului &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/infotva.html?pagina=infotva"&gt;Info TVA &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="http://www.anaf.ro/SolDecont/" target="_blank"&gt;Verificare online rambursare TVA &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/pjuridice.html?pagina=domenii"&gt;Informa&amp;#355;ii fiscale &amp;#351;i bilan&amp;#355;uri &lt;/a&gt; &lt;br&gt;&lt;hr /&gt;&lt;!-- &lt;a href ="/obiee.html?pagina=domenii"&gt;Indicatori economico-financiari &lt;/a&gt; &lt;br&gt;&lt;hr /&gt;--&gt; &lt;a href="http://www.anaf.ro/anaf/internet/ANAF/asistenta_contribuabili/programe_utile" target="_blank"&gt;ANAF-Programe utile (Declara&amp;#355;ii - ghi&amp;#351;eu , fi&amp;#351;e fiscale, Ordine de plat&amp;#259;, Centralizator autovehicule in leasing)&lt;/a&gt; &lt;br&gt; &lt;hr /&gt; &lt;a href ="http://www.anaf.ro/anaf/internet/ANAF/servicii_online/declaratii_electronice/informatii_depunere_decl_juridice" target="_blank"&gt;Informa&amp;#355;ii depunere declara&amp;#355;ii electronice &lt;/a&gt; &lt;br&gt;&lt;br&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="sub_acasa"&gt; &lt;img src="/styles/andreas01/images/institutii.jpg"&gt; &lt;br&gt; &lt;hr /&gt; &lt;a href ="/legismanag.html?pagina=domenii"&gt;Control intern/managerial &amp;#351;i control financiar preventiv &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/strategiaucaapi.html?pagina=domenii"&gt;Unitatea Central&amp;#259; de Armonizare pentru Auditul Public Intern &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/scrisoare.html?pagina=domenii"&gt;Scrisoare cadru pentru bugetul anului urm&amp;#259;tor &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/rapoarteMFP.html?pagina=domenii#tabs-2"&gt;&amp;#206;mprumuturi locale &lt;br&gt;&lt;br&gt; &lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;div id="sub_acasa"&gt; &lt;img src="/styles/andreas01/images/fizice.jpg"&gt; &lt;br&gt; &lt;a target="_blank" href ="http://discutii.mfinante.ro/static/10/Mfp/MRDG_ro_fin.pdf"&gt;Ghid pentru restructurarea extrajudiciar&amp;#259; a împrumuturilor cu garan&amp;#355;ii ipotecare &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="/despagubForm.html?pagina=acasa" target="_parent"&gt;Verificare desp&amp;#259;gubiri ANRP &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="https://www.anaf.ro/anaf/internet/ANAF/servicii_online/declaratii_electronice/Inf_depunere_persoane_fizice" target="_blank"&gt;Informa&amp;#355;ii depunere declara&amp;#355;ii electronice &lt;/a&gt; &lt;br&gt;&lt;hr /&gt; &lt;a href ="https://www.anaf.ro/anaf/internet/ANAF/asistenta_contribuabili/persoane_fizice/despre_impozite_si_taxe/Despre_impozitul_pe_venit" target="_blank"&gt;Impozitul pe venit &lt;/a&gt; &lt;!-- &lt;br&gt;&lt;hr /&gt; &lt;a href =" https://www.anaf.ro/asistpublic/?tip=mfp" target="_blank"&gt;Formular de contact MFP/ANAF &lt;/a&gt;--&gt;&lt;br&gt; &lt;br&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;/div&gt; &lt;div id="nav"&gt; &lt;div class="wrapper"&gt; &lt;h2 class="accessibility"&gt;Navigation&lt;/h2&gt; &lt;ul id="primary-nav" class="menuList"&gt; &lt;li class="menubar"&gt; &lt;a href="javascript:void(0)" title="Prezentare" style="width: 120px"&gt;Prezentare&lt;/a&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="/rol.html?pagina=acasa" title="Rolul &amp;#351;i organizarea MFP" &gt;Rolul &amp;#351;i organizarea MFP&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/istoricul.html?pagina=acasa" title="Istoric MFP" &gt;Istoric MFP&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/conducere.html?pagina=acasa" title="Conducere" &gt;Conducere&lt;/a&gt; &lt;/li&gt; &lt;li class="last"&gt; &lt;a href="/declaratii.html?pagina=acasa" title="Declara&amp;#355;ii avere &amp;#351;i interese" &gt;Declara&amp;#355;ii avere &amp;#351;i interese&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/acasa.html?method=agenda&amp;categorie=AgendaMinistru&amp;pagina=acasa" title="Agenda public&amp;#259;" &gt;Agenda public&amp;#259;&lt;/a&gt; &lt;/li&gt; &lt;li class="menubar"&gt; &lt;a href="javascript:void(0)" title="Informa&amp;#355;ii publice " style="width: 120px"&gt;Informa&amp;#355;ii publice &lt;/a&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="/planinstit.html?pagina=acasa" title="Programe &amp;#351;i strategii" &gt;Programe &amp;#351;i strategii&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/pdfbuget.html?pagina=acasa" title="Buget &amp;#351;i contabilitate intern&amp;#259;" &gt;Buget &amp;#351;i contabilitate intern&amp;#259;&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="organigr.html?pagina=acasa" title="Organigrama" &gt;Organigrama&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="rof_2009.html?pagina=acasa" title="ROF" &gt;ROF&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/proceduri.html?pagina=acasa" title="Proceduri" &gt;Proceduri&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/listadocumente.html?pagina=acasa" title="Lista documentelor" &gt;Lista documentelor&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="formularetip.html?pagina=acasa" title="Formulare tip" &gt;Formulare tip&lt;/a&gt; &lt;/li&gt; &lt;li class="last"&gt; &lt;a href="/alteinformatii.html?pagina=acasa" title="Alte informatii" &gt;Alte informatii&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/acasa.html?method=licitatie&amp;pagina=acasa" title="Achizi&amp;#355;ii publice" &gt;Achizi&amp;#355;ii publice&lt;/a&gt; &lt;/li&gt; &lt;li class="menubar"&gt; &lt;a href="javascript:void(0)" title="Transparen&amp;#355;&amp;#259; decizional&amp;#259; " &gt;Transparen&amp;#355;&amp;#259; decizional&amp;#259; &lt;/a&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="/transparent.html?method=transparenta&amp;pagina=acasa&amp;locale=ro" title="Proiecte acte normative" &gt;Proiecte acte normative&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/proiecteachizitii.html?&amp;pagina=acasa" title="Proiecte achizi&amp;#355;ii publice" &gt;Proiecte achizi&amp;#355;ii publice&lt;/a&gt; &lt;/li&gt; &lt;li class="last"&gt; &lt;a href="/acteaprobate.html?&amp;pagina=acasa" title="Acte normative aprobate" &gt;Acte normative aprobate&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/integritate.html?pagina=acasa" title="Integritate" &gt;Integritate&lt;/a&gt; &lt;/li&gt; &lt;li class="menubar"&gt; &lt;a href="javascript:void(0)" title="Cariera profesional&amp;#259;" &gt;Cariera profesional&amp;#259;&lt;/a&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="scoala_infiintare.html?pagina=scoala" title="&amp;#350;coala de finan&amp;#355;e" &gt;&amp;#350;coala de finan&amp;#355;e&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="internship.html?pagina=acasa" title="Internship 2016" &gt;Internship 2016&lt;/a&gt; &lt;/li&gt; &lt;li class="last"&gt; &lt;a href="/acasa.html?method=concurs&amp;pagina=acasa" title="Concursuri" &gt;Concursuri&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/contacte.html?pagina=acasa" title="Contacte" &gt;Contacte&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/subordonate.html?pagina=acasa" title="Institu&amp;#355;ii subordonate" &gt;Institu&amp;#355;ii subordonate&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/linkuriutile.html?pagina=acasa" title="Leg&amp;#259;turi utile" &gt;Leg&amp;#259;turi utile&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;br /&gt; &lt;div &gt; &lt;table &gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="http://www.anaf.ro" target="_blank"&gt; &lt;img src="/images/anaf.jpg" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="http://www.datoriepublica.mfinante.gov.ro/trezor/pagina.html?method=inceput&amp;locale=ro" target="_blank"&gt; &lt;img src="/images/datpub.jpg" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="http://data.gov.ro/organization/mfp" target="_blank"&gt; &lt;img src="/images/datagov.jpg" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="https://extranet.anaf.mfinante.gov.ro/anaf/extranet/Aplicatii" target="_blank"&gt; &lt;img src="/images/buton_sistem_national_raportare.jpg" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="http://www.mfinante.ro/fidelis.html?pagina=acasa" target="_parent"&gt; &lt;img src="/images/fidelis.jpg" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="http://www.mfinante.ro/loteriabonurilor.html?pagina=loteriabonurilor" target="_parent"&gt; &lt;img src="/images/loteriabonurilor.jpg" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="http://www.mfinante.ro/internship.html?pagina=acasa" target="_parent"&gt; &lt;img src="/images/internship1.jpg" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="http://www.emabucharest.ro/" target="_blank"&gt; &lt;img src="/images/emabucharest.jpg" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="http://ec.europa.eu/solvit/site/index_ro.htm" target="_blank"&gt; &lt;img src="/images/solvit1.jpg" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="https://www.anaf.ro/anaf/internet/ANAF/info_ue/m1ss/informatii_inregistrare/!ut/p/a1/hY9LD4IwEIR_iweu7EojVm8VTUl93IjQiykJL4NASoW_LxpNNFGc206-ycyChBBkpboiU6aoK1Xeb-me_Knv-g51BBdkgcwRW8HneweRDEA0APhDDD_zlG1WyDx6CKg3GPyVHwH-9B9BjlXwNXkCIxMFyKys48e7EatiQjOQOkkTnWj7qgc7N6ZplxZa2Pe9rSqV2rq28Buf162B8A2D5hKEeJ6V3Y5Nbntx4bc!/dl5/d5/L2dBISEvZ0FBIS9nQSEh/" target="_blank"&gt; &lt;img src="/images/M1SS.jpg" alt='M1SS este o aplica&amp;#355;ie care permite companiilor s&amp;#259; se înregistreze, s&amp;#259; depun&amp;#259; declara&amp;#355;ii &amp;#537;i s&amp;#259; pl&amp;#259;teasc&amp;#259; TVA datorat Statului Membru de Consum prin intermediul portalului web pus la dispozi&amp;#355;ie de c&amp;#259;tre Statul Membru de Identificare (de regul&amp;#259; Statul Membru în care compania &amp;#537;i-a stabilit activitatea economic&amp;#259;). Simplificarea const&amp;#259; în oportunitatea ca respectivele companii s&amp;#259; nu se mai înregistreze în fiecare dintre statele în care datoreaz&amp;#259; TVA, dar s&amp;#259; beneficieze de servicii electronice prin intermediul Statului Membru de Identificare. De asemenea, companiile vor fi taxate la rata TVA aplicabil&amp;#259; în Statul Membru de Consum.' title='M1SS este o aplica&amp;#355;ie care permite companiilor s&amp;#259; se înregistreze, s&amp;#259; depun&amp;#259; declara&amp;&amp;#355;ii &amp;#537;i s&amp;#259; pl&amp;#259;teasc&amp;#259; TVA datorat Statului Membru de Consum prin intermediul portalului web pus la dispozi&amp;#355;ie de c&amp;#259;tre Statul Membru de Identificare (de regul&amp;#259; Statul Membru în care compania &amp;#537;i-a stabilit activitatea economic&amp;#259;). Simplificarea const&amp;#259; în oportunitatea ca respectivele companii s&amp;#259; nu se mai înregistreze în fiecare dintre statele în care datoreaz&amp;#259; TVA, dar s&amp;#259; beneficieze de servicii electronice prin intermediul Statului Membru de Identificare. De asemenea, companiile vor fi taxate la rata TVA aplicabil&amp;#259; în Statul Membru de Consum.' border="0" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt; &lt;div id="buton"&gt; &lt;a href ="http://chat.anaf.ro/cod_tva.nsf/solicitare_tva" target="_blank"&gt; &lt;img src="/images/VIES_SOLICITARE.jpg"/&gt;&lt;/a&gt;&lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;div id="buton"&gt; &lt;a href ="http://ec.europa.eu/taxation_customs/customs/customs_duties/index_en.htm" target="_blank"&gt; &lt;img src="/images/SEED.jpg" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;div id="buton"&gt; &lt;a href ="http://ec.europa.eu/taxation_customs/vies/vatResponse.html" target="_blank"&gt; &lt;img src="/images/VIES_verificare.jpg" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;div id="buton"&gt; &lt;a href ="http://www.intrastat.ro/" target="_blank"&gt; &lt;img src="/images/intrastat.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;div id="buton"&gt; &lt;a href ="http://www.swiss-contribution.ro/swiss" target="_blank"&gt; &lt;img src="/images/swiss1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;!-- &lt;tr&gt;&lt;td&gt;&lt;div id="buton"&gt; &lt;a href ="http://conaco.ro/" target="_blank"&gt; &lt;img src="/images/CONACO.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; --&gt; &lt;table width="170" class="data" &gt; &lt;tr&gt;&lt;td &gt; Data ultimei actualiz&amp;#259;ri:&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td &gt; 20.08.2017&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;table width="170" class="data" &gt; &lt;tr&gt;&lt;td &gt; Structura &amp;#351;i grafica au fost realizate cu mijloace proprii &lt;a href=mailto:publicinfo@mfinante.ro&gt;webmaster &lt;/a&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td &gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="main"&gt;&lt;br/&gt; &lt;font size="1" style="background-color: #f4f4f4; "&gt; &lt;a href=""&gt;&lt;/a&gt;&amp;raquo; &lt;/font&gt; &lt;br&gt; &lt;div align="center"&gt;&lt;b&gt;AGENTUL ECONOMIC CU CODUL UNIC DE IDENTIFICARE null&lt;/b&gt;&lt;/div&gt; &lt;br /&gt; &lt;div style="width: 50px;border: 1px solid ;border-color: #ddddff; margin-left: 10px"&gt; &lt;a href="/pjuridice.html" &gt;Inapoi&lt;/a&gt;&lt;/div&gt; &lt;center&gt;&lt;table bgcolor="white" border="1" cellspacing="0" cellpadding="0" &gt; &lt;tr&gt; &lt;td bgcolor="#9966cc" align="left" width="345"&gt;&lt;font size="2" color="#ffffff" face="Times New Roman"&gt;Denumire platitor:&lt;/font&gt;&lt;/td&gt; &lt;td bgcolor="#9966cc" align="center" width="330"&gt;&lt;font size="2" color="#ffffff" face="Times New Roman"&gt; AMG - DIVIZIA DE SECURITATE SRL &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345" bgcolor="#fcf8f5" &gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Adresa:&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330" bgcolor="#fcf8f5" &gt;&lt;font size="2" face="Times New Roman"&gt; Str. SUCEVEI &amp;nbsp;&amp;nbsp;8A &amp;nbsp;&amp;nbsp;Bistriţa &amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Judetul:&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; BISTRIŢA-NĂSĂUD &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Numar de inmatriculare la Registrul Comertului:&lt;/font&gt;&lt;/td&gt; &lt;td bgcolor="#fcf8f5" align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; J06 /693 /2012 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Act autorizare:&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; - &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Codul postal:&lt;/font&gt;&lt;/td&gt; &lt;td bgcolor="#fcf8f5" align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; - &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Telefon:&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 0755695901 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Fax:&lt;/font&gt;&lt;/td&gt; &lt;td bgcolor="#fcf8f5" align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; - &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Stare societate: &lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt;INREGISTRAT din data 08 Noiembrie 2012&lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Observatii privind societatea comerciala:&lt;/font&gt;&lt;/td&gt; &lt;td bgcolor="#fcf8f5" align="center" width="330"&gt;-&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Data inregistrarii ultimei declaratii: (*)&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 22 Martie 2016 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Data ultimei prelucrari: (**)&lt;/font&gt;&lt;/td&gt; &lt;td bgcolor="#fcf8f5" align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 22 Martie 2016 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Impozit pe profit (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; NU &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Impozit pe veniturile microintreprinderilor (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td bgcolor="#fcf8f5" align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 01-01-2016 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Accize (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; NU &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt;  &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Taxa pe valoarea adaugata (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 12-11-2012 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Contributia de asigurari sociale (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 01-01-2013 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Contributia de asigurare pentru accidente de munca si boli profesionale datorate de angajator (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 01-01-2013 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt;   &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Contributia de asigurari pentru somaj (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 01-01-2013 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Contributia angajatorilor pentru Fondul de garantare pentru plata creantelor sociale (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 01-01-2013 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Contributia pentru asigurari de sanatate (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 01-01-2013 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt;  &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Contributii pentru concedii si indemnizatii de la persoane juridice sau fizice (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 01-01-2013 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Taxa jocuri de noroc (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt;NU&lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Impozit pe veniturile din salarii si asimilate salariilor (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; 01-01-2013 &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt;    &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Impozit pe constructii(data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; NU &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt;    &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Impozit la titeiul si la gazele naturale din productia interna (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; NU &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr align="left"&gt; &lt;td bgcolor="#fcf8f5" width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Redevente miniere/Venituri din concesiuni si inchirieri (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; NU &lt;/font&gt;&lt;/td&gt; &lt;/tr&gt;  &lt;tr align="left"&gt; &lt;td width="345"&gt;&lt;font size="2" color="#0B0B0B" face="Times New Roman"&gt;Redevente petroliere (data luarii in evidenta):&lt;/font&gt;&lt;/td&gt; &lt;td align="center" width="330"&gt;&lt;font size="2" face="Times New Roman"&gt; NU &lt;/font&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt;
  </code></pre>
  
  <p>Now from here I want to extract a few fields like "Adresa", "Numar de inmatriculare la Registrul Comertului", more exactly their value.</p>
  
  <p>I'm tired of trying. I tried to find an element, a div, anything that would specifically lead to those values, but there are none. I've tried to work with str_replace and replace all the words that I don't need like:</p>
  
  <pre><code>str_replace("&lt;div", "", $htmlcode);
  str_replace("&lt;/div", "", $htmlcode);
  </code></pre>
  
  <p>etc,, but it doesn't work. On some elements it does replace them, but on most it does nothing as if it couldn't replace them and yes I'm sure I typed correctly.</p>
  
  <p>I tried strip_tags which doesnt work at all, it doesnt change the string</p>
  
  <p>What can I do?</p>
  
  <p>EDIT: This is not a duplicate, a simple look on other methods isn't going to solve it, I already read the post Lawrance pointed towards, I tried to make a DOMDOCUMENT as well and find elements that way, but it doesn't return anything, here:</p>
  
  <pre><code>$dom= new DOMDocument();
  $dom -&gt;loadHTML($htmlcode);
  $dom -&gt;validate();
  $tds= $dom-&gt;getElementsByTagName('td');
  foreach($tds as $node) {
    $dom-&gt;saveHTML($node);
  }
  </code></pre>
  
  <p>The problem is that whatever method I'm trying to extract the infor appears to find nothing in the given string.</p>