Created
January 12, 2018 12:46
-
-
Save xikaos/96f88cb52bbff5d0d42e807e711935dd to your computer and use it in GitHub Desktop.
Varpost
This file contains 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
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