Skip to content

Instantly share code, notes, and snippets.

@ArionHardison
Last active August 29, 2015 14:01
Show Gist options
  • Save ArionHardison/7fc9a3bc96e47bb31adf to your computer and use it in GitHub Desktop.
Save ArionHardison/7fc9a3bc96e47bb31adf to your computer and use it in GitHub Desktop.
<?php
$url ="https://labourclp188.nationbuilder.com/api/v1/sites/labourclp188/pages/basic_pages?access_token=1dbc3ed982c56e725e5d1fc4739be05f3c5b26ad5d3ac407b5cb54bcda4849c9";
$data = array(
'basic_page' => array(
'slug' => "my-page",
'status' => "published",
'name' => "my-page",
'headline' => "my-page",
'content' => "<p>Hello world</p>",
),
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_TIMEOUT, '10'); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Accept: application/json"));
$json_data = json_encode($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
$json_response = curl_exec($ch);
curl_close($ch);
$response = json_decode($json_response, true);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment