forked from rugk/threema-msgapi-sdk-php
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split CurlHttpDriver out of Connection and simplified. ConnectionSett…
…ings no longer needed: they are all driver parameters now
- Loading branch information
Showing
28 changed files
with
382 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
<?php | ||
|
||
use Threema\MsgApi\Connection; | ||
use Threema\MsgApi\ConnectionSettings; | ||
|
||
require_once '../vendor/autoload.php'; | ||
|
||
//define your connection settings | ||
$settings = new ConnectionSettings( | ||
'*YOUR_GATEWAY_THREEMA_ID', | ||
'YOUR_GATEWAY_THREEMA_ID_SECRET' | ||
$driver = new \Threema\MsgApi\HttpDriver\CurlHttpDriver( | ||
'*YOUR_GATEWAY_THREEMA_ID', | ||
'YOUR_GATEWAY_THREEMA_ID_SECRET' | ||
); | ||
|
||
//create a connection | ||
$connector = new Connection($settings); | ||
|
||
$connector = new Connection($driver); | ||
|
||
$result = $connector->fetchPublicKey('ECHOECHO'); | ||
if($result->isSuccess()) { | ||
echo 'public key '.$result->getPublicKey() . "\n"; | ||
} | ||
else { | ||
echo 'error '.$result->getErrorMessage() . "\n"; | ||
if ($result->isSuccess()) { | ||
echo 'public key ' . $result->getPublicKey() . "\n"; | ||
} else { | ||
echo 'error ' . $result->getErrorMessage() . "\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
<?php | ||
|
||
use Threema\MsgApi\Connection; | ||
use Threema\MsgApi\ConnectionSettings; | ||
|
||
require_once '../vendor/autoload.php'; | ||
|
||
//define your connection settings | ||
$settings = new ConnectionSettings( | ||
'*YOUR_GATEWAY_THREEMA_ID', | ||
'YOUR_GATEWAY_THREEMA_ID_SECRET' | ||
$driver = new \Threema\MsgApi\HttpDriver\CurlHttpDriver( | ||
'*YOUR_GATEWAY_THREEMA_ID', | ||
'YOUR_GATEWAY_THREEMA_ID_SECRET' | ||
); | ||
|
||
//create a connection | ||
$connector = new Connection($settings); | ||
$connector = new Connection($driver); | ||
|
||
$senderPrivateKey = "MY_PUBLIC_KEY_IN_BIN"; | ||
|
||
$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($senderPrivateKey,$connector); | ||
$result = $e2eHelper->sendTextMessage("TEST1234", "thePublicKeyAsHex", "This is an end-to-end encrypted message"); | ||
$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($senderPrivateKey, $connector); | ||
$result = $e2eHelper->sendTextMessage("TEST1234", "thePublicKeyAsHex", "This is an end-to-end encrypted message"); | ||
|
||
if(true === $result->isSuccess()) { | ||
echo 'Message ID: '.$result->getMessageId() . "\n"; | ||
} | ||
else { | ||
echo 'Error: '.$result->getErrorMessage() . "\n"; | ||
if (true === $result->isSuccess()) { | ||
echo 'Message ID: ' . $result->getMessageId() . "\n"; | ||
} else { | ||
echo 'Error: ' . $result->getErrorMessage() . "\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.