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

  • SEARCH
  • Home
  • 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 7956327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:57:29+00:00 2026-06-04T03:57:29+00:00

I first want to say I’m a beginner with PHP and my code is

  • 0

I first want to say I’m a beginner with PHP and my code is definitely not efficient to say the least.

The issue I’m having currently is I want to parse the CURL response in a manner to grab several field name values and assign them to a variable. Once I have the variables I’ll display some fields back to the customer and some to a database. I know what fields will be sent back as I’m working with PayPal’s APIs however I am unsure on how to “grab” them from the response.

Here is my script I’m currently using, again not very efficient however I’m stuck after the CURL request. Any help is greatly appreciated!!

<?php
include_once "constants.php";

foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $wppro = "$key=$value";
}

$ipaddress = "216.113.168.139";
$creditcardtype = $_POST["creditcardtype"];
$acct = $_POST["acct"];
$expmo = $_POST["expmo"];
$expyear = $_POST["expyear"];
$cvv = $_POST["cvv"];
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$street = $_POST["street"];
$street2 = $_POST["street2"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip = $_POST["zip"];
$countrycode = $_POST["countrycode"];
$amt = $_POST["amt"];

$expdate = $expmo . $expyear; 
$method = "DoDirectPayment";

$nvp = "version=$version&method=$method&user=$api_user&pwd=$api_pwd&signature=$api_sig&ipaddress=$ipaddress&$creditcardtype=$creditcardtype&acct=$acct&expdate=$expdate&cvv=$cvv&firstname=$firstname&lastname=$lastname&street=$street&street2=$street2&city=$city&state=$state&zip=$zip&countrycode=$countrycode&amt=$amt";

$ch = curl_init();    // Starts the curl handler
curl_setopt($ch, CURLOPT_URL,$sburl); // Sets the paypal address for curl
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Returns result to a variable instead of echoing
curl_setopt($ch, CURLOPT_TIMEOUT, 60); // Sets a time limit for curl in seconds (do not set too low)
curl_setopt($ch, CURLOPT_POST, 1); // Set curl to send data using post
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvp); // Add the request parameters to the post
$httpResponse = curl_exec($ch); // run the curl process (and return the result to $result
curl_close($ch);

Thank you,

Matt

  • 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-04T03:57:30+00:00Added an answer on June 4, 2026 at 3:57 am

    How about this? It’s not super elegant, but I think it will work.

    $response = 'TIMESTAMP=2012-05-18T21:18:41Z&CORRELATIONID=c864cbb25fc2d&ACK=Success&VERSION=87&BUILD=2929894&AMT=1.00&CURRENCYCODE=USD&AVSCODE=X&CVV2MATCH=M&TRANSACTIONID=6AS92013633623055';
    
    $response = explode('&',$response);
    
    $data = array();
    foreach($response AS $key => $value){
        $newValues = explode('=',$value);
        $data[$newValues[0]] = $newValues[1];
    }
    

    A print_r($data) results in…

    Array
    (
        [TIMESTAMP] => 2012-05-18T21:18:41Z
        [CORRELATIONID] => c864cbb25fc2d
        [ACK] => Success
        [VERSION] => 87
        [BUILD] => 2929894
        [AMT] => 1.00
        [CURRENCYCODE] => USD
        [AVSCODE] => X
        [CVV2MATCH] => M
        [TRANSACTIONID] => 6AS92013633623055
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First thing i want to say that it's not an easy question to explain,
First off I want to say that I am not using threads or multiple
Hi Masters Of Web Development, first I want to say that I did not
First of all I want to say I am not a programmer but I
At first I want to say: I couldn't find a support forum for this
First off i want to say im attempting (and mostly succeeding) to use purely
Say I want to take the first item of the lists '(4 3 1)
say I want to make the first row of the excel ss something like
First I want to say that I read: UdpClient, Receive() right after Send() does
First I want to say that I'm really new to neural networks and I

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.