Page 1 of 1

How do I capture the raw URL-string $_POST data ?

Posted: Wed Oct 21, 2009 10:03 am
by FeralReason
I'm looking for a way to capture the raw URL-encoded string from which $_POST variables come (complete with ampersands, hex numbers, etc.) (I need this in order to visually check the validity of PayPal IPNs being sent to my handler code.)

Is there a function to capture this as a string ?

Thanx ! Glenn

Re: How do I capture the raw URL-string $_POST data ?

Posted: Wed Oct 21, 2009 10:08 am
by el_gato
use var_dump($_POST)

Re: How do I capture the raw URL-string $_POST data ?

Posted: Wed Oct 21, 2009 10:27 am
by FeralReason
Thanx much el_gato - will use this if I can't find any other solution.

However, this dumps the data after processing it into an array and I am looking for a way to capture the raw URL-encoded string before this happens -- with ampersands intact (as field=value seperators), %FF type hex numbers (in lieu of special characters like @, ',', ';'), '+'s in lieu of spaces, etc.

I want to visually check the actual URL-encoded string that PayPal is sending me.

(Appreciate your reply tho, this was a function I was unfamiliar with.)

Re: How do I capture the raw URL-string $_POST data ?

Posted: Wed Oct 21, 2009 10:59 am
by el_gato
Yeah i see, try use:

Code: Select all

 
echo file_get_contents('php://input'); 
 
that will print raw post data as explained here

Or in another way using Firefox addon LIVE HTTP HEADRS to view live HTTP headers.

Re: How do I capture the raw URL-string $_POST data ?

Posted: Wed Oct 21, 2009 11:24 am
by FeralReason
Hey -- almost perfect !

The only odd thing I see is that the @ sign is displayed as '@' instead of %40.

However -- I think this is close enough for horseshoes and hand grenades !


Thanx much for your help !
Glenn

Re: How do I capture the raw URL-string $_POST data ?

Posted: Wed Oct 21, 2009 11:29 am
by FeralReason
Nope -- it works perfectly ! There was a problem with my ipnGenerator code.

Thanx again !!