-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
69 lines (48 loc) · 1.48 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
header("Content-Type: application/json");
// Import the Composer autoloader
require __DIR__ . '/vendor/autoload.php';
// Import the PSGC class
use Rootscratch\PSGC\PSGC;
// Instantiate the PSGC class
$psgc = new PSGC();
/**
* Call the Regions method
* https://psgc.rootscratch.com/region
*/
// Call the Regions method
$regions = $psgc->Regions('1300000000');
// Call the Regions method without parameters
$regions = $psgc->Regions();
// Output the result
echo json_encode($regions, JSON_PRETTY_PRINT);
/**
* Call the Provinces method
* https://psgc.rootscratch.com/province
*/
// Call the Provinces method
$provinces = $psgc->Provinces('1339000000');
// Call the Provinces method without parameters
$provinces = $psgc->Provinces();
// Output the result
echo json_encode($provinces, JSON_PRETTY_PRINT);
/**
* Call the MunicipalAndCities method
* https://psgc.rootscratch.com/municipal-city
*/
// Call the MunicipalAndCities method
$municipalAndCities = $psgc->MunicipalAndCities('1339010000');
// Call the MunicipalAndCities method without parameters
$municipalAndCities = $psgc->MunicipalAndCities();
// Output the result
echo json_encode($municipalAndCities, JSON_PRETTY_PRINT);
/**
* Call the Barangays method
* https://psgc.rootscratch.com/barangay
*/
// Call the Barangays method
$barangays = $psgc->Barangays('133901001');
// Call the Barangays method without parameters
$barangays = $psgc->Barangays();
// Output the result
echo json_encode($barangays, JSON_PRETTY_PRINT);