Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 522083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:19:04+00:00 2026-05-13T08:19:04+00:00

I’m trying to write a simple PHP script which automatically sets up new etherpads

  • 0

I’m trying to write a simple PHP script which automatically sets up new etherpads (see http://etherpad.com/).

They don’t have an API (yet) for creating new pads so I’m trying to figure if I can do things another way.

After playing around some, I found that if you append a random string to etherpad.com to a not-yet-created pad, it’ll come back with a form asking if you want to create a new etherpad at that address. If you submit that form, a new pad will be created at that URL.

My thought then was I could just create a PHP script using CURL that would duplicate that form and trick etherpad into creating a new pad at whatever URL I give it. I wrote the script but so far I can’t get it working. Can someone tell me what I’m doing wrong?

First, here’s the HTML form on the etherpad creation page:

`

<p><tt id="padurl">http://etherpad.com/lsdjfsljfa-fdj-lsdf</tt></p>

<br/>
<p>There is no EtherPad document here. Would you like to create one?</p>

<input type="hidden" value="lsdjfsljfa-fdj-lsdf" name="padId"/>
<input type="submit" value="Create Pad" id="createPad"/>

`

Then here’s my code which tries to submit the form using CURL

$ch = curl_init();

//set POST variables
$url = "http://etherpad.com/ep/pad/create?padId=ldjfal-djfa-ldkfjal";
$fields = array(
  'padId'=>urlencode("ldjfal-djfa-ldkfjal"),
);

$useragent="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)";  

// set user agent  
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); 

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value; }
print_r($fields_string);

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);

//execute post
$result = curl_exec($ch);
print_r($result);
//close connection
curl_close($ch);

When I run the script, PHP reports back that everything executed correctly but etherpad doesn’t create my pad. Any clues what’s going on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:19:04+00:00Added an answer on May 13, 2026 at 8:19 am

    Here’s the answer a friend helped me come up with:

    They’re apparently doing some cookie
    validation, that’s why your script
    isn’t working. You can find this out
    by loading the new pad creation prompt
    page, clearing your cookies, and then
    reloading the page. It won’t work.
    Tricky, but effective for most casual
    bots.

    Here’s a script that gets around the
    limitation. Just insert your desired
    $padId and away you go.

    <?php
    
    $padId = 'asdfjklsjfgadslkjflskj';
    
    $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, 'http://etherpad.com/' . urlencode 
    ($padId));
    $result = curl_exec($ch);
    echo $result;
    
    # next, post to actually create the etherpad
    curl_setopt($ch, CURLOPT_URL, 'http://etherpad.com/ep/pad/create');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'padId=' . urlencode($padId));
    $result = curl_exec($ch);
    echo $result;
    
    curl_close($ch);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 377k
  • Answers 377k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The EXE for the 2nd project needs to have a… May 14, 2026 at 8:46 pm
  • Editorial Team
    Editorial Team added an answer You need to create an iterator that returns the Items… May 14, 2026 at 8:46 pm
  • Editorial Team
    Editorial Team added an answer MonthCalendarCell cell = this.Rows[i].Cells[j] as MonthCalendarCell; if(cell != null) {… May 14, 2026 at 8:46 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.