nine72 Posted March 10, 2012 Share Posted March 10, 2012 Hey everyone... Been over a year or more since I have had seek help here but I have something that I just do not understand. I am submitting a from from one domain - www.mydomain.com - to a form handler on another domain - www.theirdomain.com all under https. The form data is getting to theridomain.com just fine, the other side is handling it properly and all is well there. The issue is they are taking the response they generate and shipping it out via cURL using the below (they were nice enough to share this with me). $url = $_SESSION['request']['retUrl']; $fields = array( 'hash'=>rawurlencode($hash), 'responseText'=>rawurlencode($_SESSION['response']['responseText']), 'cid'=>rawurlencode($_SESSION['request']['cid']), 'name'=>rawurlencode($_SESSION['request']['name']), 'actCode'=>rawurlencode($_SESSION['response']['actCode']), 'apprCode'=>rawurlencode($_SESSION['response']['applCode']), 'Token'=>rawurlencode($_SESSION['response']['token']), 'req_number'=>rawurlencode($_SESSION['request']['req_number']), ); foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); if (isset($_SESSION['request']['Address1'])) { $Address = array( 'Address1'=>rawurlencode($_SESSION['request']['Address1']), 'Address2'=>rawurlencode($_SESSION['request']['Address2']), 'City'=>rawurlencode($_SESSION['request'][City']), 'State'=>rawurlencode($_SESSION['request'][state']), 'Zip'=>rawurlencode($_SESSION['request']['Zip']), 'Country'=>rawurlencode($_SESSION['request']['Country']), ); foreach($Address as $key=>$value) { $Address_string .= $key.'='.$value.'&'; } rtrim($Address_string,'&'); } $end = array( 'END'=>"END" ); foreach($end as $key=>$value) { $end_string .=$key.'='.$value; } rtrim($end_string,'&'); I have worked for almost a week and I CANNOT snag the incoming data! All I am trying to do is collect this and convert it into $_SESSION data for use on a success page. If any one has any thoughts or in site, please.... Quote Link to comment https://forums.phpfreaks.com/topic/258622-converting-an-incoming-postencoded-sting-from-another-domain/ Share on other sites More sharing options...
requinix Posted March 10, 2012 Share Posted March 10, 2012 All those hash=, responseText=, and so on are the keys. There's no intermediary array or something. Assuming they POST it, $_POST["hash"] $_POST["responseText"] // etc The $fields stuff should always be there but $Address ones might not be. There's also the END that I'm sure you'll want to ignore. If you still can't get to it, dump out $_POST (or $_GET) with var_dump() or print_r() and see exactly what you're getting. (that's assuming the rest of their stuff works... those rtrim()s they have cast some doubt) Quote Link to comment https://forums.phpfreaks.com/topic/258622-converting-an-incoming-postencoded-sting-from-another-domain/#findComment-1325738 Share on other sites More sharing options...
nine72 Posted March 14, 2012 Author Share Posted March 14, 2012 requinix, if figured out what is going on with it FINALLY. Here is what's happening... When the request is passed to their domain there are 2 url's being passed to them. 1) a response url - this is where their cURL is sending the response information and it is a php script page directly on the server and NOT connected to any other pages, no redirects, no session set up etc. It reads the incoming as $_REQUEST and then tosses it (somewhere, I have no figured out that part yet). 2) redirect url - this url is set up after the cURL is closed as a header redirect on their side and redirects the uses browser to a given page, in this case one that just tells the user that their record has been added, and provides no details of the response. So that is why I could not grab any of the response data - Oh and btw, this is not my code, looks like I am maybe #5 working with it over the years. Thanks for the looks and the help. Quote Link to comment https://forums.phpfreaks.com/topic/258622-converting-an-incoming-postencoded-sting-from-another-domain/#findComment-1327373 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.