sford999 Posted March 27, 2013 Share Posted March 27, 2013 (edited) I'm trying to make a payment gateway for my script but i`m having a problem with the output The code // redirect to the payment gateway $desc = urlencode($days.' days extension for '.$username); $sign = calculateWidgetSignature($params, $secret_key); $gatewayUrl = 'http://paymentprocessor.com/gateway?'; $gatewayUrl .= 'key='.$app_key.'&'; $gatewayUrl .= 'uid='.$userId.'&'; $gatewayUrl .= 'widget='.$widget.'&'; $gatewayUrl .= 'amount='.$amount.'&'; $gatewayUrl .= 'currencyCode='.$ccode.'&'; $gatewayUrl .= 'ag_name='.$desc.'&'; $gatewayUrl .= 'ag_external_id='.$days.'&'; $gatewayUrl .= 'ag_type=fixed&'; $gatewayUrl .= 'ag_period_length='.$days.'&'; $gatewayUrl .= 'ag_period_type=day&'; $gatewayUrl .= 'ag_recurring=0&'; $gatewayUrl .= 'sign_version=2&'; $gatewayUrl .= 'sign='.$sign; The problem is when I echo/print the $gatewayUrl I get the following http ://paymentprocessor.com/gateway?key=random_string&uid=1&widget=p4_1&amount=10¤cyCode=USD&ag_name=30+days+extension+for+username&ag_external_id=30&ag_type=fixed&ag_period_length=30&ag_period_type=day&ag_recurring=0&sign_version=2&sign=random_string The highlighted part in red is stopping the code from working as its meant to say "¤cyCode" not ¤cyCode Edited March 28, 2013 by sford999 Quote Link to comment https://forums.phpfreaks.com/topic/276242-building-urls-help/ Share on other sites More sharing options...
Solution jazzman1 Posted March 28, 2013 Solution Share Posted March 28, 2013 (edited) Replace all "&" symbols with its a html entity name "&" $gatewayUrl .= 'key='.$app_key.'&'; http://www.utexas.edu/learn/html/spchar.html Are you planning to use this url in javascript? Edited March 28, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/276242-building-urls-help/#findComment-1421532 Share on other sites More sharing options...
sford999 Posted March 28, 2013 Author Share Posted March 28, 2013 Thanks i now it was an amatur mistake And no, Its not going to be used in javascript Quote Link to comment https://forums.phpfreaks.com/topic/276242-building-urls-help/#findComment-1421544 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.