0

I am using

  <textarea id="content" name="content" style="width:0; height:0;">  
<?php  $content = file_get_contents($url);    ?> 
</textarea>

and i am posting this text area to a php file

$file = $_POST["content"];
echo $file;

The output that i am getting displayed Everything with an extra \"

All the images , all the references... Any solution for this ?

Yahoo
  • 4,093
  • 17
  • 59
  • 85

2 Answers2

5

For a start, the code in the textarea won't actually output anything, since all it's doing is assigning the contents of $url to the $content variable. Try using echo to output it:

<?php echo file_get_contents($url) ?>

As for the slashes, it sounds like a magic quotes problem. You can easily check this in the course of a script by calling get_magic_quotes_gpc, which will return true if the feature is enabled. The PHP website has some useful information on how to disable it.

Will Vousden
  • 32,488
  • 9
  • 84
  • 95
  • How do i know is it On or Off on the server ? The php ini which is in my dir contains only one line allow_url_include = On – Yahoo Jan 30 '11 at 09:40
  • Read the links I provided. As I said, `get_magic_quotes_gpc` will return `true` if it's on. – Will Vousden Jan 30 '11 at 10:22
3

Check if you have magic quotes activated.

You can check this, either in your configuration-files, or by viewing the output of php_info(). Here are instructions on how to disable this "feature".

aioobe
  • 413,195
  • 112
  • 811
  • 826