Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
2 days is enough, so I'll bug you all about it. :-)

I'm new to PHP but have to use it.

My web server is receiving this from another server at 192.168.2.2 on the LAN. The following is from the apache access log. Notice how all the variables on the query string are nice and populated.

192.168.2.2 - - [27/Jan/2014:02:05:27 -0700] "GET /GetActCode.php?productid=5&customeremail=buyer@paypalsandbox.com&customername=John Smith&code=AVEP-SBU7-ND5K&orderref=989062279&lastname=Smith HTTP/1.0" 200 113 "-" "-"


Here is the receiving script. Not much to it. Originally, the $_GETs were all $_REQUEST.
It makes no difference however.

Only $name and $email are being filled, all other variables, $last, $actcode and $ordernum are always blank. Have been for the 2 days I have had the script running.

I'm about to throw in the towel.

GetActCode.php

$name = $_GET['customername'];
$last = $_Get['lastname'];
$email = $_GET["customeremail"];
$actcode = $_GET['code'];
$ordernum = $_GET["orderref"];

?>

Thank in advance again and sorry to be such a PITA.

-Sigh... Ron
Posted
Comments
Vedat Ozan Oner 26-Jan-14 17:53pm    
some suggestions:
1- run GetActCode.php with "GET /GetActCode.php?productid=5&customeremail=buyer@paypalsandbox.com&customername=John Smith&orderref=989062279&lastname=Smith&code=AVEP-SBU7-ND5K". (I moved to code= part to the end) see what happens.
2- using "customername=JohnSmith"
3- using "code=0"
4- make sure GetActCode.php is your GetActCode.php
5- edit GetActCode.php and remove lines after $name, copy "$name" line, paste as it. then rename variables.

Your code looks like it is supposed to work! This is what I would do in this situation:

1. Remove all not-working variables, then put them back in one by one, testing the code with each addition, seeing what trips the system, etc.

2. Create a small scale simulation with some files that you use only for testing, like this:

UserTest.php:
PHP
<?

$firstname = 'John';
$lastname = 'Doe';
$email = 'johndoe@gmail.com';
$code = 'AVEP-SBU7-ND5K';
$orderref = '989062279';

//Redirect the user
header('Location: http://www.<your site="">.com/ReceiverTest.php?firstname='. $firstname .'&lastname='. $lastname .'&email='. $email .'&code='. $code  .'&orderref='. $orderref;

?>



ReceiverTest.php:
PHP
<?

$firstname = $_GET['firstname'];
$lastname = $_GET['lastname'];
$email = $_GET['email'];
$code = $_GET['code'];
$orderref = $_GET['orderref'];

echo '

<html>
<head></head>
<body>
<h1>Returned Values:</h1>
<p>First Name:'. $firstname .'</p>
<p>Last Name:'. $lastname .'</p>
<p>Email:'. $email .'</p>
<p>Code:'. $code .'</p>
<p>Order Ref:'. $orderref .'</p>
</body>
</html>

';

?>



Then, save these files so that the first can call the second, then test it by opening UserTest.php and see what you see on ReceiverTest.php.

Hope this helps :-)
 
Share this answer
 
v2
Comments
Ron Anders 26-Jan-14 18:34pm    
Thanks Guys.

Now I have some things to try tonight.
I have run out of tests.

:Ron
Ron Anders 26-Jan-14 18:50pm    
It had not dawned on me to just call GetActCode with a browser pointing at localhost.
Doing so just populates the variables as expected, but when coming in from the LAN, Not so much.

I'll keep at it and let you know.
Ron Anders 26-Jan-14 19:43pm    
If I call the GetActCode from the calling server's browser, it works.
But not from the calling server's script.

I did not know how to "simulate" the calling of GetActCode.php but it looked like fopen() was the way to do it with 'r' as it's mode. that's how I am doing it in the calling script.

Should I call GetActCode.php a different way?

:Ron
Ron Anders 26-Jan-14 21:54pm    
Looks like header() maybe the way to call the script on the far server.
I'll have to wait until tomorrow to try.

Thanks everyone!
Mitchell J. 26-Jan-14 22:12pm    
Ok. Good luck!
I "Fixed" it.

Like a More - Ron I was sending FirstName LastName as Customername and all variables following were "ignored" presumebly because of the space. Attempts to replace space with %20 didn't work for me so I stopped using the full name and just started passing around fist and last in separate variables.

I didn't really fix it it's just working now and I feel like a tool but tomorrow is another day.

Thanks for all you guys.

:Ron
 
Share this answer
 
Comments
Mitchell J. 28-Jan-14 3:06am    
Glad to see that you "fixed" it :-)

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900