forked from followupp/php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Followupp.php
44 lines (35 loc) · 1.13 KB
/
Followupp.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* A PHP package for working with Followupp.co
*
* @package Followupp
* @author Justin Velluppillai <[email protected]
* @link http://https://github.com/followupp/php
* @license MIT License
*/
class Followupp
{
public static function request($arguments = array())
{
$endpoint = 'https://www.followupp.co/api/messages';
// setup curl request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arguments));
$response = curl_exec($ch);
// catch errors
if (curl_errno($ch)) {
curl_close($ch);
return false;
} else {
curl_close($ch);
return json_decode($response);
}
}
}