Skip to content

Instantly share code, notes, and snippets.

@xikaos
Created January 12, 2018 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xikaos/96f88cb52bbff5d0d42e807e711935dd to your computer and use it in GitHub Desktop.
Save xikaos/96f88cb52bbff5d0d42e807e711935dd to your computer and use it in GitHub Desktop.
Varpost
function varpost($endpoint, $data){
$ch = curl_init($endpoint);
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
CURLOPT_POSTFIELDS => json_encode($data)
));
$response = curl_exec($ch);
if($response === FALSE){
die(curl_error($ch));
} else {
echo('Varpost sent!');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment