Skip to content

Instantly share code, notes, and snippets.

@KyleAMathews
Created November 6, 2010 04:41
Show Gist options
  • Save KyleAMathews/665203 to your computer and use it in GitHub Desktop.
Save KyleAMathews/665203 to your computer and use it in GitHub Desktop.
Create etherpad with this script
<?php
$padId = 'testingmoreplease';
$domain = "http://piratepad.net";
$ch = curl_init();
# for debugging
curl_setopt($ch, CURLOPT_HEADER, true);
# parse cookies and follow all redirects
curl_setopt($ch, CURLOPT_COOKIEFILE, '/dev/null');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
# first, post to get a cookie
curl_setopt($ch, CURLOPT_URL, $domain . '/ep/pad/create');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'padId=' . urlencode($padId));
$result = curl_exec($ch);
# next, post to actually create the etherpad
curl_setopt($ch, CURLOPT_URL, $domain . '/ep/pad/create');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'padId=' . urlencode($padId));
$result = curl_exec($ch);
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment