0

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).

But

$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?

Thanks

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by Kieran Y5
0

Hi,

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:

if(!get_magic_quotes_gpc())
{
  $source = addslashes($_POST['source']);
}
else
{
  $source = $_POST['source'];
}

For more on the get_magic_quotes_gpc() function, check out http://www.php.net/manual/en/function.get-magic-quotes-gpc.php

I hope this solves your problem,
Kieran :)

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.