Skip to content

Instantly share code, notes, and snippets.

@raddeus
Created October 18, 2017 19:44
Show Gist options
  • Save raddeus/a02c7fcb8ecec37c90f515dacc5fc506 to your computer and use it in GitHub Desktop.
Save raddeus/a02c7fcb8ecec37c90f515dacc5fc506 to your computer and use it in GitHub Desktop.
$postBody = [
'test' => 'test'
];
$baseUrl = 'http://localhost:4000';
$ch = curl_init();
curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_URL, $baseUrl);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postBody));
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
//curl_setopt($ch, CURLOPT_USERPWD, $userpwd);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json'
));
$result = curl_exec($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment