-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
example.php
54 lines (42 loc) · 1.54 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @title Example Usage of the pH7CMS HTTP REST Push Data
*
* @author Pierre-Henry Soria <[email protected]>
* @copyright (c) 2015-2016, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
*/
require 'PH7CMS.class.php';
/*
* The Private pH7CMS API Key. It is available in your ~/_protected/app/configs/config.ini file after the installation.
*/
$oPH7CMSApi = new PH7\External\Api\PH7CMS('4545s5sq5ss5sd4s5ds4d5s5d4qs', 'http://http://localhost/GitHub/pH7-Social-Dating-CMS');
//---------- ADD ACCOUNT ----------\\
$aNewUser = [
'email' => '[email protected]',
'username' => 'usersample',
'password' => '123456pH7CMS89',
'first_name' => 'Pete',
'last_name' => 'Donovan',
'sex' => 'male',
'match_sex' => 'female',
'birth_date' => '10/16/1994', // Format: mm/dd/yyyy
'country' => 'GB',
'city' => 'Newcastle upon Tyne',
'state' => 'Tyne and Wear',
'zip_code' => 'NE6 1AH',
'description' => 'I want to meet some nice girls'
];
// Ass the user
$oPH7CMSApi->post('api/user/createaccount', $aNewUser);
// Show the response
echo var_dump($oPH7CMSApi->getResponse());
//---------- LOGIN ----------\\
$aUserLogin = [
'email' => '[email protected]',
'password' => '123456pH7CMS89'
];
// Login the user
$aRes = $oPH7CMSApi->post('api/user/login', $aUserLogin)->getResponse(PH7\External\Api\PH7CMS::ARR_TYPE); // Get the response in Array
// Show the response
echo var_dump($aRes);