Hi I am trying to use tokbox video chat API integration on my website.
What I did:
I download their project from tokbox php. Using composer I install required repository files and create vendor folder. Now according to their instruction I add api-key and secret-key in run-demo file and compile run-demo batch file using cmd. When I visit their server link http://localhost:8080/session
Its shows You must define an TOKBOX_API_KEY and TOKBOX_SECRET in the run-demo file
.
run-demo file
#!/bin/sh
if [ -z "$TOKBOX_API_KEY" ] || [ -z "$TOKBOX_SECRET" ]
then
export TOKBOX_API_KEY=<MY_API_KEY>
export TOKBOX_SECRET=<MY_API_SECRET>
fi
if [ -d "storage" ]
then
rm -rf storage/
fi
php -S 0.0.0.0:8080 -t web web/index.php
and
:: Why? because windows can't do an OR within the conditional
IF NOT DEFINED TOKBOX_API_KEY GOTO defkeysecret
IF NOT DEFINED TOKBOX_SECRET GOTO defkeysecret
GOTO skipdef
:defkeysecret
SET TOKBOX_API_KEY=
SET TOKBOX_SECRET=
:skipdef
RD /q /s storage
php.exe -S localhost:8080 -t web web/index.php
How could I solve this ?
Did you use run-demo script ?
The run-demo file starts the PHP CLI development server (requires PHP >= 5.4) on port 8080. Start the server using the run-demo script: $ ./run-demo. You can refer this link for reference - https://github.com/opentok/learning-opentok-php/blob/master/README.md
Now according to their instruction I add api-key and secret-key in run-demo file and compile run-demo batch file using cmd.
It looks like you have editted the run-demo
shell script for running on linux/mac, but you are running the windows batch file run-demo.bat
. You need to add the api key and secret to that file: https://github.com/opentok/learning-opentok-php/blob/master/run-demo.bat
run-demo.bat
:
:: Why? because windows can't do an OR within the conditional
IF NOT DEFINED TOKBOX_API_KEY GOTO defkeysecret
IF NOT DEFINED TOKBOX_SECRET GOTO defkeysecret
GOTO skipdef
:defkeysecret
SET TOKBOX_API_KEY=<YOUR_API_KEY_HERE>
SET TOKBOX_SECRET=<YOUR_SECRET_HERE>
:skipdef
RD /q /s storage
php.exe -S localhost:8080 -t web web/index.php