Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8334769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:27:28+00:00 2026-06-09T03:27:28+00:00

UPDATE 1: I also have the following foreach loop in my code: foreach ($_POST

  • 0

UPDATE 1:

I also have the following foreach loop in my code:

foreach ($_POST as $key => $value){ 
    $message .= $key . " = " .$value ."\n\n<br />"; 
}

Which is the final one.

Or maybe the problem is in the line:

curl_setopt($ch, CURLOPT_POSTFIELDS, $req);

Doesn’t like the %5B0%5D in the string generated, i.e.

transaction%5B0%5D=USD+21.00

using the code $req = http_build_query($_POST);?

ORIGINAL QUESTION:

I’m getting the following error message:

[Sun Aug 04 10:00:00 2012] [error] [client 000.0.00.000] PHP Warning:  stripslashes() expects parameter 1 to be string, array given in /var/www/page.php on line 20
[Sun Aug 04 10:00:00 2012] [error] [client 000.0.00.000] PHP Stack trace:
[Sun Aug 04 10:00:00 20122] [error] [client 000.0.00.000] PHP   1. {main}() /var/www/page.php:0
[Sun Aug 04 10:00:00 2012] [error] [client 000.0.00.000] PHP   2. stripslashes() /var/www/page.php:20

The problem code is this:

Line 19: foreach ($_POST as $key => $value) {
Line 20:     $value = urlencode(stripslashes($value));
Line 21:     $req .= "&$key=$value";
Line 22: }

Where $_POST contains the following:

Array
(
    [transaction] => Array
        (
            [0] => USD 21.00
        )

    [payment_request_date] => Sat Aug 04 10:00:00 PDT 2012
    [return_url] => http://000.000.000.000/success.php
    [fees_payer] => EACHRECEIVER
    [ipn_notification_url] => http://000.000.000.000/ipn.php
    [sender_email] => buyer_0394820394_per@gmail.com
    [verify_sign] => slkdfj30r2489urj0947830ru0ty80ur0er037jfgoiru932e.as329e
    [test_ipn] => 1
    [cancel_url] => http://000.000.000.000/cancel.php
    [pay_key] => AP-SLKJ30F9J90J3RSD3
    [action_type] => PAY
    [transaction_type] => Adaptive Payment PAY
    [tracking_id] => E4902RJF2
    [status] => COMPLETED
    [log_default_shipping_address_in_transaction] => false
    [charset] => windows-1252
    [notify_version] => UNVERSIONED
    [reverse_all_parallel_payments_on_error] => false
)

Is the stripslashes() giving me a problem because of the array within an array? If yes, how can I deal with the $_POST in the foreeach loop, if no, what could the problem be?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:27:29+00:00Added an answer on June 9, 2026 at 3:27 am

    Just use the function http_build_query, which will generate a URL-encoded query string for you.

    $query_str = http_build_query($_POST);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code which gives the warning in the title. I am
I have put several buttons and panels in my update panel. I also have
I have a trigger for insert/update/delete. That is working fine. Also, I need the
So, I have a usercontrol with an update panel. I also put a button
I need to update the primary key for a record but it's also the
I have the following HTML in a JSP file: <div class=custList> <table class=dataGrid> <c:forEach
I have the following code that works: @for (var index = 0; index <
I have the following code: public class OMyObject { public int Id { get;
I have an SQL query that takes the following form: UPDATE foo SET flag=true
I have the following code: $data['x'] = $this->x->getResults(); $data['y'] = $data['x']; //some code here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.