/    Sign up×
Community /Pin to ProfileBookmark

Value of print_r()

Hi, I want to email myself the contents of a post array ($_POST). This is just so i can check when errors are occurring during a curl request.

I just want to be able to view the post array as i would if i did: print_r($_POST).

But how do i add the contents to the mail function?

I need something like this (this just prints 1 for the array.)

mail(‘[email protected]‘, ‘Title’, print_r($_POST), $headers);

Is there a way i can do this, another function perhaps?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiFeb 09.2010 — [code=php]print_r($_POST, true);

// or for html email
sprintf('<pre>&#37;s</pre>', print_r($_POST, true));
[/code]
Copy linkTweet thisAlerts:
@MindzaiFeb 10.2010 — That script won't work. First of all it will give a parse error, but aside from that it will only ever give you the last element of the $_POST superglobal. It also can't display arrays of more than a single dimension.
×

Success!

Help @coldscooter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...