-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
48 lines (40 loc) · 1.49 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
<?php
include "Pingen.php";
$objPingen = new Pingen('mytoken');
try {
/* example uploading a document, and automatically sending it priority and in color */
$objResponse = $objPingen->document_upload('example.pdf', 1, Pingen::SPEED_PRIORITY, Pingen::PRINT_COLOR);
/* grab send/post id */
$iSendId = $objResponse->send[0]->send_id;
/* check status of my sending */
$objSend = $objPingen->send_get($iSendId);
/*
to see all status codes go to:
https://www.pingen.com/en/developer/objects-post.html
*/
$iStatusCode = $objSend->item->status;
// /* example of adding a letter */
// $objLetterResponse = $objPingen->letter_add(array(
// 'recipients' => array(
// array(
// 'name' => 'David Peterson',
// 'address' => "Longstreet 4\n8005 Zürich\nSwitzerland"
// ),
// ),
// 'place' => 'Zürich',
// 'date' => '2013-03-20',
// 'title' => 'Testdocument',
// 'content' => "This is my multiline content<br>fully <i>capable</i> of <b>html</b>"
// ));
//
// /* grab letter id just created */
// $iLetterId = $objLetterResponse->id;
//
// /* sending this letter */
// $objSendLetterResponse = $objPingen->letter_send($iLetterId, 1, 1);
//
// $iSendId = $objSendLetterResponse->id;
}catch (Exception $e)
{
echo 'An error occured with number <b>' . $e->getCode() . '</b> and message <b>' . $e->getMessage() . '</b>';
}