The situation is this, I go on eBay do a search, look at the source code, copy the area that I want to parse, paste it in my script, run the script and get what I want from it.

So basically in my script I have a variable like this

$source = "here I paste the source code that I copied from eBay (after escaping all the double quote)";

I used preg_match_all on the string I just pasted and everything works fine.

Now the problem:

I want to use a form with a textarea where I would paste the source code copied from eBay and than submit to my script (instead of hardcoding in the script than upload the script than run the script).


$source = $_POST; does not work, I tried

$source = htmlentities($_POST); and still not working

but if I echo $source the data is all there but it is not getting parse by the script.

So my questions are why is it not working and how to fix it?



You could try adding slashes to the string addslashes(); You might be using magic quotes to. Use get_magic_quotes_gpc() and if it is false, using the addslashes() function. Example:

  $source = addslashes($_POST['source']);
  $source = $_POST['source'];

For more on the get_magic_quotes_gpc() function, check out

I hope this solves your problem,
Kieran :)

Hi Kieran thanks for the reply, I tried both ways with the double quote escaped or not escaped, proven by echoing the post data after manipulation and either way the text is not being parsed by the script.

It is very frustrating because if I copy and paste the text that I just echoed from the post data into the script (hardcoded) and run the script again it would parsed no problem.

Almost like the script would run prior of the data being posted.

I have no idea then, I thought that magic quotes was the answer :(