-
Notifications
You must be signed in to change notification settings - Fork 0
/
addTag.php
36 lines (24 loc) · 1.07 KB
/
addTag.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
//
$URL = 'http://www.librarything.com/signup.php';
$arrayOptions = array();
$arrayOptions['formusername'] = 'skifftest';
$arrayOptions['formpassword'] = 'skifftest';
$arrayOptions['index_signin_already'] = "Sign in";
require_once('simpletest/browser.php');
$browser = new SimpleBrowser();
$result = $browser->get('http://www.librarything.com/');
$browser->setFieldById('already_formusername', 'skifftest');
$browser->setFieldByName('formpassword', 'skifftest');
$result = $browser->clickSubmitByName('index_signin_already');
$collection = 7763391;
$book = 81847707;
$newEmailAddress = '[email protected]';
$updateFormURL = sprintf("http://www.librarything.com/work/%d/edit/%d", $collection, $book);
$submitform = $browser->get($updateFormURL);
$currentTagesArray = explode(', ', $browser->getFieldById('form_tags'));
array_push($currentTagesArray, $newEmailAddress);
$newTags = implode(', ', $currentTagesArray);
$browser->setFieldById('form_tags', $newTags);
$result = $browser->submitFormById('book_editForm');
echo $result;