Skip to content

Instantly share code, notes, and snippets.

@hatimn02
Last active August 3, 2016 06:00
Show Gist options
  • Save hatimn02/52b7abea3c65c7aff98fefb95a286428 to your computer and use it in GitHub Desktop.
Save hatimn02/52b7abea3c65c7aff98fefb95a286428 to your computer and use it in GitHub Desktop.
PHP sample code
<?php
// The data to send to the Flow
$data_string = array(
'contact_no' => '999999999',
'caller_phone' => '888888888',
'company' => 'socket',
'branch_info' => 'India',
);
$postData = json_encode($data_string);
$URL = 'FLOW_URL_WITH_AUTH_KEY'; //https://viasocket.com/t/y8K5iJYnC69VM5wMPKJ/my-testing?authkey=zqkUoQdhskfdsfdsf
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$URL);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json')
);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status code
$result=curl_exec ($ch);
echo $ch;
curl_close ($ch);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment