-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
27 lines (20 loc) · 804 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
$url = 'https://sandbox.safaricom.co.ke/mpesa/c2b/v1/registerurl';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json','Authorization:Bearer ACCESS_TOKEN')); //setting custom header
$curl_post_data = array(
//Fill in the request parameters with valid values
'ShortCode' => ' ',
'ResponseType' => ' ',
'ConfirmationURL' => 'http://ip_address:port/confirmation',
'ValidationURL' => 'http://ip_address:port/validation_url'
);
$data_string = json_encode($curl_post_data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
$curl_response = curl_exec($curl);
print_r($curl_response);
echo $curl_response;
?>