Click here to Skip to main content
14,212,560 members
Rate this:
Please Sign up or sign in to vote.
See more:

This bit of code is to generate a query string from POST items back from PayPal to send to a licensing server but I am getting variable names not variable values.

$CustomerEmail = $_POST['payer_email'];
$CustomerName = $_POST['address_name'];
$OrderRef = $_POST['txn_id'];


Results in: - - [24/Jan/2014:10:55:29 -0700] "GET /keygen.php?productid=5&\"$CustomerEmail\"&\"$CustomerName\"&quantity=\"1\"\"&OrderRef\" HTTP/1.0" 200 978 "-" "-"

What I want is: - - [24/Jan/2014:10:55:29 -0700] "GET /keygen.php?productid=5&\ Doe&quantity="1" 1234567890 HTTP/1.0" 200 978 "-" "-"

The way PHP deals with values of variables vs variable names is throwing this PHP rookie for a loop!

Thanks in advance

Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi Ron,

Try this:

fopen('' . $CustomerEmail . '&' . $CustomerName . '&quantity="1""&OrderRef"','r');

I've done PayPal integration with PHP before myself - not fun!!
Let me know if this helps. :-)
Ron Anders 24-Jan-14 20:43pm

Thanks man! That did it.

Onward and Upward!
Mitchell J. 24-Jan-14 20:46pm
You're welcome.
Rate this:
Please Sign up or sign in to vote.

Solution 2

PHP doesn't do the variable interpolation into strings delimited with the single-quote (') character.[^]

But just using the dot (.) to concatenate, as shown by CraigDJ is probably clearer, since you have double-quotes within the string.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190619.2 | Last Updated 24 Jan 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100