Jump to content

Striping down html


graham23s

Recommended Posts

Hi Guys,

 

I have put together the code:

 

<?php
   $prodID  = $_GET['productID'];
   $q       = mysql_query("SELECT * FROM `dig_products` WHERE `id`='$prodID'");
   $a       = mysql_fetch_array($q);
   $u       = $a['product_original_url'];
   
    /*$opts = array(
      'http'=> array(
        'method' => "GET",
        'header' => "Accept-Encoding: gzip;q=0, compress;q=0\r\n", //Sets the Accept Encoding Feature.
      )
    );*/
    
   //$context = stream_context_create($opts); 
  
   $c       = file_get_contents($u);

   echo $c;
   //$html   = file_get_html($s)->plaintext;
   //$html   = strip_tags($html);
   $i      = mysql_query("UPDATE `dig_products` SET `product_sourced_description`='$c' WHERE `id`='$prodID'");
   
   echo "<center><form action=\"\" method=\"POST\">
         <textarea rows=\"50\" cols=\"50\">$c</textarea>
         <hr />
         <input type=\"hidden\" name=\"prodID\" value=\"$prodID\" />
         <input type=\"submit\" name=\"submitDescription\" value=\"Use This Description\" />         
         </form></center>";
   //echo "<pre>$html</pre>";
?>

 

to grab the contents of a specific webpage, it works as it should but i just want the text of the page stripping away all html and excess spaces, i was using simple html dom to grab the web page but i reverted back to file_get_contents, strip_tags() is wiorking but doesn't seem to be as thorough it leaves some javascript for example in the text, is there a function to strip it down even more?

 

thanks for any help guys

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/205257-striping-down-html/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.