-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.php
85 lines (58 loc) · 2.43 KB
/
test.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
//include_once('../middleware/authenticate.php');
function getTicketUrl($nn,$sn,$an,$pan,$denomination) {
return getRaidaUrl(0) . "get_ticket?nn=" .$nn. "&sn=".$sn. "&an=" .$an."&pan=".$pan."&denomination=".$denomination;
}
function getTestTicket() {
$nn= 1;
$sn = 6300997;
$an = "01267590cbbfa3076c5710c6e1915975";
$pan = "01267590cbbfa3076c5710c6e1915975";
$denomination = "100";
$ticketurl = getTicketUrl($nn,$sn,$an,$pan,$denomination);
$ch = curl_init();
//Set the URL that you want to GET by using the CURLOPT_URL option.
curl_setopt($ch, CURLOPT_URL, $ticketurl);
//Set CURLOPT_RETURNTRANSFER so that the content is returned as a variable.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//Set CURLOPT_FOLLOWLOCATION to true to follow redirects.
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
//Execute the request.
$data = curl_exec($ch);
//Close the cURL handle.
curl_close($ch);
$obj = json_decode($data);
$status = $obj -> {'status'};
$ticket = $obj -> {'message'};
return array("status" => $status, "ticket" => $ticket , "sn" => $sn);
}
// $nn= 1;
// $sn = 6300997;
// $an = "01267590cbbfa3076c5710c6e1915975";
// $pan = "01267590cbbfa3076c5710c6e1915975";
// $denomination = "100";
// $ticketurl = getTicketUrl($nn,$sn,$an,$pan,$denomination);
// $ch = curl_init();
// //Set the URL that you want to GET by using the CURLOPT_URL option.
// curl_setopt($ch, CURLOPT_URL, $ticketurl);
// //Set CURLOPT_RETURNTRANSFER so that the content is returned as a variable.
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// //Set CURLOPT_FOLLOWLOCATION to true to follow redirects.
// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// //Execute the request.
// $data = curl_exec($ch);
// //Close the cURL handle.
// curl_close($ch);
// $obj = json_decode($data);
// $status = $obj -> {'status'};
// $ticket = $obj -> {'message'};
// http_response_code(200);
// // tell the user no products found
// echo json_encode(
// array("funcval" => getTestTicket(),
// "status" => $status, "ticket" => $ticket, "an" => $an , "pan" => $obj -> {'status'} , "ticket_response" => preg_replace('/\\\\/', '', $data))
// );
// echo json_encode(preg_replace('/\\\\/', '', $data));
?>