2 #$output = file_get_contents('out.html'); #'Content to put in page';
3 print "THIS DOESN'T WORK CURRENTLY\n".
4 $output = 'Content to put in page';
7 $server = 'http://www.planet-lab.org/';
8 $url = $server.'user/login';
9 $vars['edit[name]'] = 'emailaddr';
10 $vars['edit[pass]'] = 'yourpassword';
11 $vars['edit[form_id]'] = 'planetlab_login_block';
12 $vars['op'] = 'Log in';
14 curl_setopt($ch, CURLOPT_URL, $url);
15 curl_setopt($ch, CURLOPT_HEADER, 1);
16 curl_setopt($ch, CURLOPT_USERAGENT, 'PHP script');
17 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
18 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
19 curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
20 curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
21 curl_setopt($ch, CURLOPT_POST, 1);
22 curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
23 $data = curl_exec($ch);
24 print "Curl returned: $data\n";
29 $url = $server . "node/$nid/edit";
30 curl_setopt($ch, CURLOPT_URL, $url);
31 $vars['edit[title]'] = 'Node Manager API Documentation';
32 $vars['edit[body]'] = $output;
33 $vars['edit[format]'] = '2'; /* filtered html */
34 $vars['edit[comment]'] = '0';
35 $vars['edit[parent]'] = '0';
36 $vars['edit[name]'] = 'drupal';
37 $vars['edit[changed]'] = time();
38 #$vars['edit[date]'] = '2008-02-27 16:01:59 +0000';
40 $vars['edit[menu][title]'] = 'NM API';
41 $vars['edit[menu][description]'] = 'Node Manager API';
42 $vars['edit[menu][pid]'] = '61'; // --- API
43 $vars['edit[menu][path]'] = 'node/236';
44 $vars['edit[menu][weight]'] = '0';
45 $vars['edit[menu][mid]'] = '91';
46 $vars['edit[menu][type]'] = '118';
47 $vars['edit[menu][delete]'] = '0';
49 $vars['edit[status]'] = '1';
50 $vars['edit[revision]'] = '0';
51 $vars['edit[moderate]'] = '0';
52 $vars['edit[promote]'] = '0';
53 $vars['edit[sticky]'] = '0';
54 $vars['edit[form_id]'] = 'page_node_form';
55 $vars['op'] = 'Submit';
56 curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
58 $data = curl_exec($ch);
59 print "Curl returned: $data\n";