forked from Monopond/fax-api-client-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
113 lines (91 loc) · 3.67 KB
/
index.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
include_once './MonopondSOAPClient.php';
// TODO: Enter your own credentials here
$client = new MonopondSOAPClientV2("username", "password", MPENV::Production);
// TODO: Put your file path here
$filedata = fread(fopen("./test.txt", "r"), filesize("./test.txt"));
$filedata = base64_encode($filedata);
/* Setup Documents */
$document = new MonopondDocument();
$document->FileName = "AnyFileName1.txt";
$document->FileData = $filedata;
$document->Order = 0;
$document2 = new MonopondDocument();
$document2->FileName = "AnyFileName2.txt";
$document2->FileData = $filedata;
$document2->Order = 0;
$document3 = new MonopondDocument();
$document3->FileName = "AnyFileName3.txt";
$document3->FileData = $filedata;
$document3->Order = 0;
$document4 = new MonopondDocument();
$document4->FileName = "AnyFileName4.txt";
$document4->FileData = $filedata;
$document4->Order = 0;
/* Setup FaxMessages (Each contains an array of document objects) */
$faxMessage = new MonopondFaxMessage();
$faxMessage->MessageRef = "Testing-message-1";
$faxMessage->SendTo = "61011111111";
$faxMessage->SendFrom = "Test Fax";
$faxMessage->Resolution = "normal";
$faxMessage->Retries = 0;
$faxMessage->BusyRetries = 2;
$faxMessage->CLI = 61011111111;
$faxMessage2 = new MonopondFaxMessage();
$faxMessage2->MessageRef = "Testing-message-2";
$faxMessage2->SendTo = "61011111111";
$faxMessage2->SendFrom = "Test Fax 2";
$faxMessage2->Resolution = "normal";
$faxMessage2->Retries = 0;
$faxMessage2->BusyRetries = 2;
$faxMessage2->CLI = 61011111111;
/* Setup FaxSendRequest (Each contains an array of fax messages) */
$sendFaxRequest = new MonopondSendFaxRequest();
$sendFaxRequest->BroadcastRef = "Broadcast-test-1";
$sendFaxRequest->SendRef = "Send-Ref-1";
$sendFaxRequest->HeaderFormat = "Testing";
$sendFaxRequest->FaxMessages[] = $faxMessage;
$sendFaxRequest->FaxMessages[] = $faxMessage2;
$sendFaxRequest->Documents = array($document);
$sendFaxRequest->CLI = 3456;
/* Send request to Monopond */
$sendRespone = $client->sendFax($sendFaxRequest);
/* Display response */
print_r($sendRespone);
/* Setup FaxStatusRequest */
$faxStatusRequest = new MonopondFaxStatusRequest();
$faxStatusRequest->MessageRef = "test-2-1-1";
$faxStatusRequest->Verbosity = "all";
/* Send request to Monopond */
$faxStatus = $client->faxStatus($faxStatusRequest);
/* Display response */
print_r($faxStatus);
/* Setup StopFaxRequest */
$stopFaxRequest = new MonopondStopFaxRequest();
$stopFaxRequest->MessageRef = "test-2-2-1";
/* Send request to Monopond */
$stopFax = $client->resumeFax($stopFaxRequest);
/* Display response */
print_r($stopFax);
/* Setup StopFaxRequest */
$stopFaxRequest = new MonopondStopFaxRequest();
$stopFaxRequest->MessageRef = "test-2-2-1";
/* Send request to Monopond */
$stopFax = $client->stopFax($stopFaxRequest);
/* Display response */
print_r($stopFax);
/* Setup PauseFaxRequest */
$pauseFaxRequest = new MonopondPauseFaxRequest();
$pauseFaxRequest->MessageRef = "test-2-2-1";
/* Send request to Monopond */
$pauseFax = $client->pauseFax($pauseFaxRequest);
/* Display response */
print_r($pauseFax);
/* Setup ResumeFaxRequest */
$resumeFaxRequest = new MonopondResumeFaxRequest();
$resumeFaxRequest->MessageRef = "test-2-2-1";
/* Send request to Monopond */
$resumeFax = $client->resumeFax($resumeFaxRequest);
/* Display response */
print_r($resumeFax);
?>