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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.