-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathapi.php
More file actions
29 lines (20 loc) · 865 Bytes
/
api.php
File metadata and controls
29 lines (20 loc) · 865 Bytes
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
<?php
require 'vendor/autoload.php';
use Afzafri\PoslajuTrackingApi;
/* Poslaju Tracking API created by Afif Zafri.
Tracking details are fetched directly from Poslaju tracking website,
parse the content, and return JSON formatted string.
Please note that this is not the official API, this is actually just a "hack",
or workaround for implementing Poslaju tracking feature in other project.
Usage: http://site.com/api.php?trackingNo=CODE , where CODE is your tracking number
*/
header("Access-Control-Allow-Origin: *"); # enable CORS
header('Content-type: application/json');
if(isset($_GET['trackingNo']))
{
$trackingNo = $_GET['trackingNo']; # put your poslaju tracking number here
$trackres = PoslajuTrackingApi::crawl($trackingNo, true);
# output/display the JSON formatted string
echo json_encode($trackres);
}
?>