Created
June 7, 2019 11:08
-
-
Save jwebster/1a7967b405588534cc66a2c63c98449c to your computer and use it in GitHub Desktop.
sheepCRM API - PHP example POST
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $payload = json_encode($packet); | |
| curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
| curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); | |
| // Set URL on which you want to post the Form and/or data | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| // Header fields | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
| 'Content-type: application/json', | |
| 'Bearer: '.$apikey, | |
| 'User-Agent: '.$userAgent, | |
| 'Content-Length: '.strlen($payload)) | |
| ); | |
| // Pass TRUE or 1 if you want to wait for and catch the response against the request made | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| // For Debug mode; shows up any error encountered during the operation | |
| curl_setopt($ch, CURLOPT_VERBOSE, 1); | |
| // Execute the request | |
| $response = curl_exec($ch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment