$request = file_get_contents('php://input');
$json= json_decode($request);
// URL Shortener for Approve
$longURL= "http://<webservver link>/api/chat/MailApproval.php/".$json->taskid."/Approve";
$url = "https://api-ssl.bitly.com/v3/shorten?access_token=<bitly access token>&longUrl=".urlencode($longURL);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$respApprove = curl_exec($ch);
curl_close($ch);
// URL Shortener for Reject
$longURL= "http://<webservver link>/api/chat/MailApproval.php/".$json->taskid."/Reject";
$url = "https://api-ssl.bitly.com/v3/shorten?access_token=<bitly access token>&longUrl=".urlencode($longURL);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$respReject = curl_exec($ch);
curl_close($ch);
$respRejectJson = json_decode($respReject);
$respApproveJson = json_decode($respApprove);
// Send SMS API
$context = array();
$context["message"] = $json->message ." Approve-> ".$respApproveJson->data->url . ' Reject-> ' . $respRejectJson->data->url;
$ch1 = curl_init('https://sandbox.api.sap.com/proximusenco/sms/outboundmessages');
$request_headers = array();
$request_headers[] = 'Content-Type: application/json';
$request_headers[] = 'Accept: application/json';
$request_headers[] = 'APIKey: <API key from API hub>';
curl_setopt($ch1, CURLOPT_HTTPHEADER, $request_headers );
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch1, CURLOPT_VERBOSE, 1);
curl_setopt($ch1, CURLOPT_HEADER, 1);
$context["binary"] = false;
$context["destinations"] = [$json->destinations[0]];
curl_setopt($ch1, CURLOPT_POSTFIELDS,json_encode($context) );
$resp = curl_exec($ch1);
curl_close($ch1);
I agreed and while posting I decided to search in the same forum to see if I have missed anything in my previous searches. Luckily one of the Question had the same concern and it was mentioned that Header field support is not available as of now.So, my wrapper-based approach was correct one. Secondly don’t search only on google. Earlier google use to list down all results from SCN/SDN forums now I believe it is not. So learning here is apart from google search use exclusive search on SAP site.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
11 | |
5 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |