Skip to content

Instantly share code, notes, and snippets.

@jwebster
Created June 7, 2019 11:08
Show Gist options
  • Select an option

  • Save jwebster/1a7967b405588534cc66a2c63c98449c to your computer and use it in GitHub Desktop.

Select an option

Save jwebster/1a7967b405588534cc66a2c63c98449c to your computer and use it in GitHub Desktop.
sheepCRM API - PHP example POST
$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