macii2508 Posted August 23, 2007 Share Posted August 23, 2007 Ok...I am new to the shopping care online processing world. Here's the deal...From my website you can register for a webinar when you click the link it takes you to a third party shopping cart which is imbeaded in a frame on my site. It updates the cart with the item and then the end user posts their data (cc and other info). Then if processing is good they will be redirected to the registration page of the web conferencing site via the Approved Url link I set up in the 3rd party payment system. This all works fine untill you add another product for the customer to purchace which when purchaced they will need to be redirected to a different link.... the third party payment system will only let me re-direct to one Url on approved processing. So the folks at the payment gateway told me I need to utilize a post back script in which they will send information to a url (mysite.com/script?) with the details of the transaction of the transaction...order#,prod_ID..etc and with this I can send back a specific link to be shown to the end user for the product they oredered??? Make sense? Can I accomplish this with php? or do I need to use a cgi script? everywhere I look online people are using .asp to acomplish this.. my site runs on apache/php/mysql on linux server. Can someone point me in the right direction. Thanks. Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 23, 2007 Share Posted August 23, 2007 I assume they mean they send data back to your site using GET. This would be a URL like: mysite.com/script.php?var=val&va2=val2. All you have to do is use the $_GET array inside your script.php file to send their data. In the example, $_GET['var'] would contain "val". Quote Link to comment Share on other sites More sharing options...
macii2508 Posted August 24, 2007 Author Share Posted August 24, 2007 So by using this script I can gather the email address and the product id and send an email or direct them to a web page witht the link to veiw the webinar? Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 24, 2007 Share Posted August 24, 2007 Probably. It all depends on what their server sends yours. Quote Link to comment Share on other sites More sharing options...
macii2508 Posted August 24, 2007 Author Share Posted August 24, 2007 Ok...well I have a pdf the sent me with all of the fields they send...I guess my question is how do I turn that string of data into something the script will understand fo instance if I tell turn the function on and have them send it to mysite.com/script.php and they send one big glob of data...how will the script be able to handle the glob of data it could be field1field2field3field3...etc how will the script know where field2 is in the string they send? Im sorry if im being ignorant...Is there a way I can turn on the function and have it written to a txt file to see how the date is coming in to my server? Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 24, 2007 Share Posted August 24, 2007 PHP does all the parsing of the data they send and, like I said, puts it into the $_GET[] array. All you have to do is read through the pdf and see what the names are and use them just by putting $_GET['name']. Quote Link to comment Share on other sites More sharing options...
macii2508 Posted August 25, 2007 Author Share Posted August 25, 2007 Ok...I understand about var=val&va2=val2.....but they are just asking for a straight url in their example they show mysite.com/script.asp although Im trying to do this with php. I have created my code using the field names they are passing back. see below. But when I test this live not using the mysite.com/script.php?P_part1=val&etc.... rather just them just posting back to mysite.com/script.php I does not function properly. Im assuming this method wont work with php if they cant send the var=val&va1=val portion in the url.. Im guessing .asp can handle this? Any information would be great. The only other thing I can guess is that I have the code right and they just are passing any vars back.  <?php // Gets the product Id and the Name and email and then posts the proper link     $string1 = strtolower($_GET['P_part1']);     $string2 = strtolower($_GET['C_name']);     $string3 = strtolower($_GET['C_email']);     if (strpos($string1,'apsw082207') > -1) { $is_prod = 'http://www.site1.com/event.asp?id=42057'; }     elseif (strpos($string1,'apsw092607') > -1) { $is_prod = 'http://site2.com/example.html'; }     else { $is_prod = 'sorry'; } echo '     <p>Hello <strong>' . $string2 . '</strong></p>     <p><a href=' . $is_prod . '>Click here to continue registration</a></p>     <p>Your <strong>' . $string3 . '</strong> has been recorded. Thanks</p> '; ?> Quote Link to comment Share on other sites More sharing options...
macii2508 Posted August 27, 2007 Author Share Posted August 27, 2007 Any Ideas? thanks Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 27, 2007 Share Posted August 27, 2007 The URL they send back doesn't have the var=val&va1=val part in it? If not, ther are probably using POST instead of GET, try changing from $_GET to $_POST. Quote Link to comment Share on other sites More sharing options...
macii2508 Posted August 27, 2007 Author Share Posted August 27, 2007 lemmin thanks for your help...im sure I am annoying you by now.. here is the example they give if I were going to be using .asp code. Â <% 'Post Back Services Sample Handler Script '======================================================= 'This sample extracts the elements returned via the Post 'Back Service and Logs them to a Local File '======================================================= Set fileobject = CreateObject("Scripting.FileSystemObject") Set log_file = fileobject.OpenTextFile("C:\postback.txt",8,True) log_file.Write "-------------------------------------------------------------------" & vbCrLf log_file.Write Now() & vbcrlf for i = 1 to Request.Form.Count log_file.Write Request.Form.Key(i) & " = " & Request.Form.Item(i) & vbcrlf next log_file.Write "-------------------------------------------------------------------" & vbCrLf log_file.close %> Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 27, 2007 Share Posted August 27, 2007 Yeah, I think that is how asp handles POST. Did you try using the $_POST[] array instead of the $_GET[] array? Quote Link to comment Share on other sites More sharing options...
macii2508 Posted August 27, 2007 Author Share Posted August 27, 2007 Lemmin....I just tried with the $_Post....worked like a charm...Thanks a bunch...Can i buy you lunch!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.