-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed examples, added cmt to file, tested. it is ready
- Loading branch information
Showing
6 changed files
with
105 additions
and
19 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
set_time_limit(0); | ||
|
||
require('../../vendor/autoload.php'); | ||
|
||
|
||
use PubNub\PubNub; | ||
use PubNub\PNConfiguration; | ||
|
||
if ($argc < 3) { | ||
echo "Usage: php file.php <uuid> <channel> <message> <custom_message_type>\n"; | ||
exit(1); | ||
} | ||
|
||
$pnUuid = $argv[1] . '-pn-610da4553bb079.92567429'; | ||
|
||
$pnConfig = new PNConfiguration(); | ||
$pnConfig->setPublishKey(getenv('PN_KEY_PUBLISH')); | ||
$pnConfig->setSubscribeKey(getenv('PN_KEY_SUBSCRIBE')); | ||
$pnConfig->setUuid($pnUuid); | ||
|
||
$pubnub = new PubNub($pnConfig); | ||
$file = fopen('pn.jpg', 'rb'); | ||
$pubResult = $pubnub->sendFile() | ||
->channel($argv[2]) | ||
->message($argv[3]) | ||
->customMessageType($argv[4]) | ||
->fileHandle($file) | ||
->fileName('pn.jpg') | ||
->sync(); | ||
|
||
print("Published file"); |
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