Skip to content

Instantly share code, notes, and snippets.

@piiskop
Created March 20, 2018 20:31
Show Gist options
  • Save piiskop/41575d4393e3689352dea13b6a0f74ea to your computer and use it in GitHub Desktop.
Save piiskop/41575d4393e3689352dea13b6a0f74ea to your computer and use it in GitHub Desktop.
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
// @formatter:off
$url = sprintf(
'http://%1$s:%2$u/study-groups?format=json&id=3',
$_SERVER['SERVER_NAME'], // 1
$_SERVER['SERVER_PORT'] // 2
);
// @formatter:on
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, array (
'Content-Type: application/json'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
header("Content-Type:application/json");
print_r($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment