Cannot strip all of the css and html tags and attributes from a web page with PHP

Hello! I am trying to remove any html tags which are taken using PHP Simple HTML DOM. I am using this link from ebay.com: shorturl.at/jtUX4. Until now I only managed to get rid of the attributes` content and not the actual tags and css classes. Here is my code:

            $description = $html->find("iframe[id=desc_ifr]", 0);
            //var_dump($description);
            if($description != null){
                $source = $description->src;
                //var_dump($source);
                //$item['description']=$dom->saveHTML($source);
                //$lines_string=file_get_contents($source)
                if(isset($source)){
            $descrHtml = getWebPage($source);
            unset($source);
            $descrDom = new simple_html_dom();
            $descrDom->load($descrHtml);

                    foreach ($descrDom->find("#ds_div") as $key => $div) {                   
                        $descr = $div->innertext;
                        $cleandescr = preg_replace('/<[^>]*>/', '', $descr);
                        $cleandescription = trim(preg_replace('/\s+/',' ', $cleandescr));
                        //var_dump($cleandescription);
                        $cleandescription1 = str_replace('img{max-width:100%}', '', $cleandescription);
                        $cleanedcss= preg_replace('~(?:\s*/\*.*?\*/\s*)|\{\K(?:\'[^\']*\'|"[^"]*"|/\*.*?\*/|(?:(?R)|[^}]))*~', '', $cleandescription1);
                        $cleanedclasses= str_replace('.center-page {} .push-left {} .qe td {} .qe .center {} .qe .label {} .qe .indent {} .qe .fit {} .limit-width {}', '', $cleanedcss);
                        $item['description'] = htmlspecialchars_decode(trim(str_replace("&nbsp;", "", $cleanedclasses)));  
                        $item['description']=strip_tags($cleanedcss); 
                        //var_dump($item['description']);               
                    }
                }
            }else{
                $item['description'] = '';
            }

After debug I receive this result:
body {} h1 {} } h2, h3, h4, h5, h6 {} .navbar a, .navbar a:active, .navbar a:hover, .navbar a:visited {} .product-specs {} .product-specs td {} .attr-left {} .attr-right {} div.footer {} .navbar-default {} .navbar-default .navbar-nav > .active > a {}.col-md-6{} .col-md-12{} .container{} @media (min-width:768px){ .container{} .col-md-12, .col-md-6{} .col-md-6{} } @media (min-width:992px){ .container{} .col-md-12,.col-md-6{} .col-md-6{} } @media (min-width:1200px){ .container{} .col-md-12,.col-md-6{} .col-md-6{} } .img-responsive{}.nav{} .nav:before, .nav:after{} .nav:after{} .nav:before, .nav:after{} .nav:after{} .nav > li{} .nav > li > a{} .nav > li > a:hover, .nav > li > a:focus{} .nav > li > a > img{} .navbar{} @media (min-width:768px){.navbar{} } .navbar-header:before, .navbar-header:after{} .navbar-header:after{} .navbar-header:before, .navbar-header:after{} .navbar-header:after{} @media (min-width:768px){.navbar-header

That is NOT a link from ebay…

It is a link to google docs.

Please provide a REAL link
and
do not use a ‘shirt url’ anymore… I dont want to guess where you are sending me. I will no longer assist with those type of links/projects.

You can use php strip tags… or perhaps try the plaintext method in SIMPLEHTMLDOM?

quick example:

include('simplehtmldom/simple_html_dom.php');
$html = file_get_html('https://www.ebay.com/itm/Front-strut-spacers-30mm-for-Ford-Focus2-C-Max-Focus3-Kuga-Escape-Lift-Kit/112460641185');

$textOnlyCheck = $html->find('#prcIsum');

echo  $textOnlyCheck[0]->plaintext;
Sponsor our Newsletter | Privacy Policy | Terms of Service