Solved

read a "cgi post back to my server"

Posted on 2013-07-01
6
454 Views
Last Modified: 2013-12-25
I am setting up a payment confirmation/fail page and asked the processing vendor for some sample code for retrieving the transaction details and this is the response I got.

"Here is an example of a CGI response post back to the merchant.  

{status=DUPLICATE&failReason=The+order+already+exists+in+the+database.&OID=1339768581&OID=1339768581&ttime=06%2f15%2f12+02%3a39%3a47+PM&merchant=Hardin+Solutions&merchantphone=123-456-29003&merchantemail=Jeff.koenig%commercebank.com.com&txnorg=eci&subtotal=9.00&chargetotal=9.00&cardnumber=(Visa)++....1111&expmonth=01&expyear=2013&bname=Mike+Snide&baddr1=1245+S.+Todd+St.&City%2c+State%2c+Zip%3a=Wichita%2c+KS%2c+67207&bcountry=US&userid=A33AE3E33079&bcity=Wichita&suppressTitle=true&__VIEWSTATE=%2fwEPDwUJLTc0ODU2OTMzZGQ%3d&cctype=V&invoice_number=1339768581&bzip=67207&bstate=KS}
"

I really can't figure out how to access that in php,  but even in anything would steer me in the right direction.  Thanks in advance for any help/tips....
0
Comment
Question by:ststesting
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 35

Accepted Solution

by:
gr8gonzo earned 500 total points
ID: 39291304
Usually this information comes back as a result of an attempt to send a credit card charge attempt. That's the important piece of information to confirm.

The data structure itself looks like a URL-encoded string enclosed in curly { } braces. I would normally decode it like this:

$response = "{ .... that response data .... }";
parse_str(urldecode(trim(trim($response),"{}")),$parsed_response);

// Now $parsed_response should be an array...
print_r($parsed_response);
0
 
LVL 2

Author Comment

by:ststesting
ID: 39291355
Thanks, that's perfect for making it accessible for this test.

What would I set your first line $response = to in the actual code?
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 39291413
I'm not sure, that depends on your merchant / vendor. Usually it comes back as a response from the charge submission.

e.g.

$response = try_to_charge($creditcardnumber,$other_details,$apikey);
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 2

Author Comment

by:ststesting
ID: 39291541
My charge submission is a form that redirects to their site, then the user is redirected to the confirmation page....
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 39291544
Usually in that model, the user is redirected back to the final page with the variables in the URL. If you don't see the variables in the URL, you'll have to ask the vendor how you can get them with the redirect approach.
0
 
LVL 2

Author Closing Comment

by:ststesting
ID: 39291589
Taking it back to the support guy (who is terrible, or I wouldn't be on here...).

Thanks for the quick, quality response.  Have a good one!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I Import CSV File In my PHP Application 29 78
PHP-MSSQL 2016 connection requirements for Windows 2012 29 80
history of pages 7 55
Format Date 7 28
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question