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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FeralReason
Forum Newbie
Posts: 7
Joined: Mon Apr 20, 2009 11:05 pm

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

Post 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
User avatar
el_gato
Forum Newbie
Posts: 12
Joined: Sun Oct 18, 2009 9:28 pm
Location: Bandung
Contact:

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

Post by el_gato »

use var_dump($_POST)
FeralReason
Forum Newbie
Posts: 7
Joined: Mon Apr 20, 2009 11:05 pm

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

Post 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.)
User avatar
el_gato
Forum Newbie
Posts: 12
Joined: Sun Oct 18, 2009 9:28 pm
Location: Bandung
Contact:

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

Post 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.
FeralReason
Forum Newbie
Posts: 7
Joined: Mon Apr 20, 2009 11:05 pm

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

Post 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
FeralReason
Forum Newbie
Posts: 7
Joined: Mon Apr 20, 2009 11:05 pm

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

Post by FeralReason »

Nope -- it works perfectly ! There was a problem with my ipnGenerator code.

Thanx again !!
Post Reply