diff --git a/requestcheckout.php b/requestcheckout.php new file mode 100644 index 0000000..3d3d04d --- /dev/null +++ b/requestcheckout.php @@ -0,0 +1,79 @@ +'.$PAYBILL_NO.'ZTcxY2M3M2U1ZDM1ZGEyZTRiN2UyNGUyNDk0NGQwOTVkMzgzOTNmN2UzOTEzN2RlNDE1N2M0ZjViNDIzMWU0Yw==20160426121448'.$MERCHANT_TRANSACTION_ID.''.$PRODUCT_ID.''.$AMOUNT.''.$NUMBER.''.$CALLBACK_URL.''.$CALL_BACK_METHOD.'20160426121448'; /// Your SOAP XML needs to be in this variable + +try{ + + + + +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, $ENDPOINT); +curl_setopt($ch, CURLOPT_HEADER, 0); + + +curl_setopt($ch, CURLOPT_VERBOSE, '0'); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); +curl_setopt($ch, CURLOPT_POSTFIELDS, $body); + +curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '0'); +curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '0'); + +$output = curl_exec($ch); +curl_close($ch); + + + +// Check if any error occured +if(curl_errno($ch)) +{ + echo 'Error no : '.curl_errno($ch).' Curl error: ' . curl_error($ch); +} +print_r("To complete this transaction, enter your Bonga PIN on your handset. if you don't have one dial *126*5# for instructions "); +} +catch(Exception $ex){ +echo $ex; +} + +function generateRandomString() { + $length = 10; + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $charactersLength = strlen($characters); + $randomString = ''; + for ($i = 0; $i < $length; $i++) { + $randomString .= $characters[rand(0, $charactersLength - 1)]; + } + return $randomString; +} +?>