Skip to content

Commit 72e380f

Browse files
author
Moov Space
authored
Justsend php rest api
Justsend rest php api. How to send sms message from php rest api (single and multiple messages).
1 parent 045356c commit 72e380f

File tree

1 file changed

+40
-37
lines changed

1 file changed

+40
-37
lines changed

README.md

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
1-
# JustSend API
2-
SMS PHP Api justsend.
1+
# JustSend REST API PHP
2+
Justsend rest php api. How to send sms message from php rest api (single and multiple messages).
33

4-
### Jak wysłać wiadomość do kilku odbiorców
5-
Klasa klienta w php do wysyłki wiadomości sms.
4+
### Send sms to single recipient
65
```php
7-
<?php
8-
// Show errors
9-
ini_set('display_errors', 1);
10-
ini_set('display_startup_errors', 1);
11-
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
6+
try
7+
{
8+
$curl = new JustSendClient();
9+
$curl->SetMethod("POST");
10+
$curl->SetJson();
1211

12+
// Token
13+
$curl->AddToken('API-KEY-HERE');
14+
15+
// Single number
16+
$curl->AddUrl('https://justsend.pl/api/rest/v2/message/send');
17+
18+
// Mesage
19+
$curl->AddData("bulkVariant","ECO"); // ECO, PRO, FULL
20+
$curl->AddData("doubleEncode", true);
21+
$curl->AddData("from", "HellGirl");
22+
$curl->AddData("message", "Testowa wiadomość");
23+
$curl->AddData("to", "500111222");
24+
25+
// Send
26+
echo $curl->Send();
27+
}
28+
catch(Exception $e)
29+
{
30+
print_r($e);
31+
}
32+
```
33+
34+
### Send sms to multiple recipients
35+
```php
36+
<?php
1337
// Import client
1438
require('JustSendClient.php');
1539

@@ -50,32 +74,11 @@ try{
5074
}
5175
```
5276

53-
### Jak wysłać wiadomość do jednego odbiorcy
77+
### Display php errors
5478
```php
55-
try
56-
{
57-
$curl = new JustSendClient();
58-
$curl->SetMethod("POST");
59-
$curl->SetJson();
60-
61-
// Token
62-
$curl->AddToken('API-KEY-HERE');
63-
64-
// Lub dla pojedyńczego odbiorcy
65-
$curl->AddUrl('https://justsend.pl/api/rest/v2/message/send');
66-
67-
// Wiadomość
68-
$curl->AddData("bulkVariant","ECO"); // ECO, PRO, FULL
69-
$curl->AddData("doubleEncode", true);
70-
$curl->AddData("from", "HellGirl");
71-
$curl->AddData("message", "Testowa wiadomość");
72-
$curl->AddData("to", "500111222");
73-
74-
// Send
75-
echo $curl->Send();
76-
}
77-
catch(Exception $e)
78-
{
79-
print_r($e);
80-
}
81-
```
79+
<?php
80+
// Show errors
81+
ini_set('display_errors', 1);
82+
ini_set('display_startup_errors', 1);
83+
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
84+
```

0 commit comments

Comments
 (0)