-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
40 lines (32 loc) · 984 Bytes
/
example.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
37
38
39
40
<?php
include('producteev.php');
//Set your api secret here
$api_secret = '';
//Set your api key here
$api = '';
//Check to see if the form has been submitted, if not we'll display the form
if (isset($_POST['username']) && isset($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
$p = new Producteev($api,$api_secret);
$p->SetReturnType('json');
$p->Set(array(
'email'=>$username,
'password'=>$password)
);
//Login as user defined above
$data = $p->Execute('users/login');
//Now that we're logged in lets get all our tasks
$data = $p->Execute('tasks/my_tasks');
echo '<pre>'.print_r($data,true).'</pre>';
} else {
?>
<form name="input" action="example.php" method="post">
<p>Input your username and password to display a list of all your tasks.</p>
Username: <input type="text" name="username" />
</br>
Password: <input type="password" name="password" />
</br>
<input type="submit" value="Submit" />
</form>
<?php } ?>