I am trying to integrate bigbluebutton into Codeigniter and after complete set i am not able to create meeting and other things.. below is the code
<?php
// Require the bbb-api file:
require_once('../includes/bbb-api.php');
// Instatiate the BBB class:
$bbb = new BigBlueButton();
/* ___________ CREATE MEETING w/ OPTIONS ______ */
/*
*/
$creationParams = array(
'meetingId' => '1234', // REQUIRED
'meetingName' => 'Test Meeting Name', // REQUIRED
'attendeePw' => 'ap', // Match this value in getJoinMeetingURL() to join as attendee.
'moderatorPw' => 'mp', // Match this value in getJoinMeetingURL() to join as moderator.
'welcomeMsg' => '', // ''= use default. Change to customize.
'dialNumber' => '', // The main number to call into. Optional.
'voiceBridge' => '', // PIN to join voice. Optional.
'webVoice' => '', // Alphanumeric to join voice. Optional.
'logoutUrl' => '', // Default in bigbluebutton.properties. Optional.
'maxParticipants' => '-1', // Optional. -1 = unlimitted. Not supported in BBB. [number]
'record' => 'false', // New. 'true' will tell BBB to record the meeting.
'duration' => '0', // Default = 0 which means no set duration in minutes. [number]
//'meta_category' => '', // Use to pass additional info to BBB server. See API docs.
);
// Create the meeting and get back a response:
$itsAllGood = true;
try {$result = $bbb->createMeetingWithXmlResponseArray($creationParams);}
catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
$itsAllGood = false;
}
if ($itsAllGood == true) {
// If it's all good, then we've interfaced with our BBB php api OK:
if ($result == null) {
// If we get a null response, then we're not getting any XML back from BBB.
echo "Failed to get any response. Maybe we can't contact the BBB server.";
}
else {
// We got an XML response, so let's see what it says:
print_r($result);
if ($result['returncode'] == 'SUCCESS') {
// Then do stuff ...
echo "<p>Meeting succesfullly created.</p>";
}
else {
echo "<p>Meeting creation failed.</p>";
}
}
}
?>
And what parameters have to pass to create meeting in url
Related
Using Sendinblue API, I get a Bad Request response: {"code":"invalid_parameter","message":"Invalid emails format"}when I'm trying to use the functionAddContactToList`.
I have no problem when trying to create contact. Contact is sent with emails and attributes. I want now to add existing contacts in a list.
This is the code of the add contact to list page:
// Configure API key authorization: api-key
$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'xxxxxxxxxxxxxxxxxx');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'xxxxxxxxxxxxxxxxxxxxxxx');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');
$apiInstance = new SendinBlue\Client\Api\ContactsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$row = 0;
if (($handle = fopen("contactlist.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 0, ";")) !== FALSE) {
$row++;
usleep(1000);
if($row>70){
$listId = 42; // int | Id of the list
$contactEmails = new \SendinBlue\Client\Model\AddContactToList(); // \SendinBlue\Client\Model\AddContactToList | Emails addresses of the contacts
$contactEmails['emails'] =$data[1];
echo $data[1];echo '<br>';
try {
$result = $apiInstance->addContactToList($listId, $contactEmails);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ContactsApi->addContactToList: ', $e->getMessage(), PHP_EOL;
}
echo '<br>';echo '<br>';echo '<br>';
}
if($row==400){
die();
}
}
fclose($handle);
}
?>
This is the result I get:
xxxxx#example.com
Exception when calling ContactsApi->addContactToList:
[400] Client error: POST
https://api.sendinblue.com/v3/contacts/lists/42/contacts/add resulted
in a 400 Bad Request response:
{"code":"invalid_parameter","message":"Invalid emails format"}
Thank you for your help.
Here is my working code :
require_once(__DIR__ . '/vendor/autoload.php');
$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR-APIKEY');
$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR-APIKEY');
$apiInstance = new SendinBlue\Client\Api\ContactsApi(
new GuzzleHttp\Client(),
$config
);
$createAttribute = new \SendinBlue\Client\Model\CreateAttribute([
'name' => 'Your Name',
'type' => 'email' // email, sms
]);
$createContact = new \SendinBlue\Client\Model\CreateContact([
'email' => 'test#email.be',
'attributes' => $createAttribute,
'listIds' => [28], // Int() | Number of your list in your account
]); // \SendinBlue\Client\Model\CreateContact | Values to create a contact
try {
$result = $apiInstance->createContact($createContact);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ContactsApi->createContact: ', $e->getMessage(), PHP_EOL;
}
I'm trying to create a ad via the Facebook Business SDK. Everything works well until I'm trying to create a AdCreativeVideoData. Code:
protected function createAdVideoCreative($thumbnail_url, $video_id, $name){
$video_data = new AdCreativeVideoData();
$video_data->setData(array(
AdCreativeVideoDataFields::IMAGE_URL => $thumbnail_url,
AdCreativeVideoDataFields::VIDEO_ID => $video_id,
AdCreativeVideoDataFields::CALL_TO_ACTION => array(
'type' => AdCreativeCallToActionTypeValues::LIKE_PAGE,
'value' => array(
'page' => FbAds::PAGE_ID,
),
),
));
$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
AdCreativeObjectStorySpecFields::PAGE_ID => FbAds::PAGE_ID,
AdCreativeObjectStorySpecFields::VIDEO_DATA => $video_data,
));
$creative = new AdCreative(null, FbAds::AD_ACCOUNT_ID);
$creative->setData(array(
AdCreativeFields::NAME => $name,
AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
));
try {
$creative->create();
return $creative;
} catch (Exception $e) {
print("Create Ad Video Creative Exception: " . $e->getMessage() . " (" . $e->getCode() . ")");
exit;
}
}
The above method is called when the selected video is uploaded to Facebook via the following method:
protected function createAdVideo($video_path){
$video = new Advideo(null, FbAds::AD_ACCOUNT_ID);
$video->{AdVideoFields::SOURCE} = $video_path;
try {
$video->create();
return $video->{AdVideoFields::ID};
} catch (Exception $e) {
print("Create Ad Video Exception: " . $e->getMessage() . " (" . $e->getCode() . ")");
exit;
}
}
The problem is that when I'm trying to create the AdCreativeVideoData, the following error is thrown:
[message] => Invalid parameter
[type] => OAuthException
[code] => 100
[error_subcode] => 1885252
[is_transient] =>
[error_user_title] => Video not ready for use in an ad
[error_user_msg] => The video is still being processed. Please wait for the video to finish processing before using it in an ad.
[fbtrace_id] => AwW0d9+Piz1
As you can see, the video is not yet processed. My question is: how can I check the status of the video? Is there a endpoint available somewhere which I can ping to check the status? The documentation states that I can check the status, but the AdVideo object in the createAdVideo() method doesn't have a status field:
I'm at a loss here so I hope someone can shed a light on this problem. Thanks in advance!
AdVideo does not have a status field since then, but Video does: https://developers.facebook.com/docs/graph-api/reference/video
Internally it's the same id, so you can request https://graph.facebook.com/v4.0/{video-id}?fields=id,status which will return the status of the uploaded (Ad)Video.
I'll assume it is because the video is not uploaded at all.
Instead of using "source" try using "file_url". You may also want to add a parameter "title" so it will not be named untitled video- but it is not required.
And try using the SDK smarter like so:
$myVideoUpload = (new AdAccount("act_123456676"))-
>createAdVideo(
array() //fields
array( //params
"file_url"=>"http://whatever.com",
"title"=>"my title"
)
);
if this works, it'll return a json_encodes string with id=video_id.
If you want to be able to retrieve errors- if any- and a general method for all api calls, do use the graph api as such:
$fb = new Facebook(array(
"app_id"=>"blalaa",
"app_secret"=>"blaaaaa",
"default_graph_version"=>"v9.0"
));
$url = "/act_123456789/advideos";
$access_token = "my token";
$params =
array("file_url"=>"https://whatever.com","title"=>"some video");
try{
$response = $fb->post(
$url,
$params,
$access_token
)
$response = $response->getGraphNode();
} catch(FacebookResponseException $e) {
return "graph error:: " . $e->getMessage();
} catch(FacebookSDKException$e) {
return "sdk error:: " . $e->getMessage();
}
The last one can be applied to everything given that you have an access_token that has access to the specific edge that you are requesting thus only he URL needs to be changed accordingly along with the parameters.
Note:
While using the graph-api: Use POST if you want to change or create something, and GET if you only want to read.
i am trying to get the first release date of a song using Musicbrainz. To get this i am using the mikealmond musicBrainz library.
The problem i have is that when i try to execute exactly the same code as in this example (https://github.com/mikealmond/MusicBrainz/blob/master/examples/first-recording-search.php) i always get an authentication error.
Client error response [status code] 401 [reason phrase] Unauthorized [url] http://musicbrainz.org/ws/2/artist/0383dadf-2a4e-4d10-a46a-e9e041da8eb3?inc=releases+recordings+release-groups+user-ratings&fmt=json
Therefore i tried to add my username and password to the request:
$brainz = new MusicBrainz(new GuzzleHttpAdapter(new Client()),'myusername','mypassword');
$brainz->setUserAgent('myapplicationname', '0.2', 'http://localhost:443/');
If i call the url in the error message manually and enter my username and password i get the array i expect.
I just had a discovery: If I removed -"+ user - ratings"- it does not require authentication.
Therefore i commented the lines with "user - ratings" in my project
Now i think it works, but the performance of the query is very bad and often i get Error 503 // The MusicBrainz web server is currently busy. Please try again later. //
It takes a few seconds just for one song. Does someone know if this is normal or if i still have some kind of mistake?
My code....
//Create new MusicBrainz object
$brainz = new MusicBrainz(new GuzzleHttpAdapter(new Client()), 'username', 'password');
$brainz->setUserAgent('applicationname', '0.2', 'http://localhost:443/');
// set defaults
$artistId = null;
$songId = null;
$lastScore = null;
$firstRecording = array(
'releaseDate' => new DateTime()
);
// Set the search arguments to pass into the RecordingFilter
$args = array(
"recording" => 'we will rock you',
"artist" => 'Queen',
);
try {
// Find all the recordings that match the search and loop through them
$recordings = $brainz->search(new RecordingFilter($args));
$recorings i can print and in the loop i can print each $recording, but the error comes when i extract the informations
/** #var $recording \MusicBrainz\Recording */
foreach ($recordings as $recording) {
// if the recording has a lower score than the previous recording, stop the loop.
// This is because scores less than 100 usually don't match the search well
if (null != $lastScore && $recording->getScore() < $lastScore) {
break;
}
$lastScore = $recording->getScore();
$releaseDates = $recording->getReleaseDates();
$oldestReleaseKey = key($releaseDates);
if (strtoupper($recording->getArtist()->getName()) == strtoupper($args['artist'])
&& $releaseDates[$oldestReleaseKey] < $firstRecording['releaseDate']
) {
$firstRecording = array(
'releaseDate' => $recording->releases[$oldestReleaseKey]->getReleaseDate()
);
}
}
pr($firstRecording);
} catch (Exception $e) {
pr($e->getMessage());
}
$brainz = new MusicBrainz(new GuzzleHttpAdapter(new Client()), 'username', 'password');
You must set your MusicBrainz account credentials. Replace 'username' with your account username, and 'password' with the password used to login to MusicBrainz.org
I am new to the programming area and this is my first nusoap-0.9.5 client and server program. Although the the server looks correct the client keeps giving me this warning:
PHP Fatal error: SoapClient::SoapClient(): Invalid parameters in /var/www/client.php on line 5
PHP Fatal error: Uncaught SoapFault exception: [Client] SoapClient::SoapClient(): Invalid parameters in /var/www/client.php:5
Stack trace:
#0 /var/www/client.php(5): SoapClient->SoapClient('http://localhos...', true)
#1 {main}
thrown in /var/www/client.php on line 5
Anybody knows the reason? I am trying to find a solution over the net more than a week now and I can not understand what is wrong with my program why it is not working.
Client code:
Thanks again Davey, I have read all the tutorials that you recommend and I am still a bit confused but at least less confused than before. I have modified my code again, I hope it makes more sense now. So here it is:
<?php
include "conf_client.php";
require_once('nusoap.php');
$client = new soapclient('http://localhost:8048/server.php?wsdl',true);
class Data {
public $acro = acro;
public $note = note;
public $prio = prio;
public $date = date;
public function Delete() {
$create = array ($acro,
$date,
$note,
$prio);
return $create;
}// End of Function Delete
}// End of class Data
$data = new Data();
$delete = $data->Delete();
$response = $client->call('Lists.DeleteToDo',$delete);
var_dump($response);
?>
directory: {file:///var/www/server.php}
Any help is much appreciated.
'List.DeleteToDo'
Is the class: List and the Function: DeleteToDo on the side of the server that I am calling.
I manage to find more about my problem and I have solved it. I am posting my server code here maybe it can help also someone else.
As a beginner I have simplified the code as much as possible. I am not including to my answer the configuration file, but if anybody needs it please let me know and I will post it as well.
I would also like to say thank you to everyone who answered my query at this forum and help me understand my errors.
<?php
include "conf.php";
require_once('nusoap/lib/nusoap.php');
$server = new soap_server();
$server->configureWSDL('This is my First nuSoapServer', 'urn:nuSoapServer');
$server->wsdl->addComplexType('Data',
'compexType',
'struct',
'all',
'',
array('id' => array('name' => 'id', 'type' => 'xsd:int'),
'acro' => array('name' => 'acro', 'type' => 'xsd:string'),
'time' => array('name' => 'time', 'type' => 'xsd:string'),
'date' => array('name' => 'date', 'type' => 'xsd:string'),
'note' => array('name' => 'note', 'type' => 'xsd:string'),
'prio' => array('name' => 'prio', 'type' => 'xsd:int'),
'data' => array('name' => 'data', 'type' => 'xsd:string')
)
);
$server->wsdl->addComplexType(
'DataArray', // Name
'complexType', // Type Class
'array', // PHP Type
'', // Compositor
'SOAP-ENC:Array', // Restricted Base
array(), // Elements
array( // Atributes
array('ref' => 'SOAP-ENC:arrayType',
'wsdl:arrayType' => 'tns:Data[]')
),
'tns:Data'
);
$server->register('GetTodoList', // method name
array('acro' => 'xsd:string'), // input parameters
array('DataResult' => 'tns:DataArray'), // output parameters
'urn:nuSoapServer', // namespace($namespace)
'urn:nuSoapServer#GetTodoList', // soap action
'rpc', // style
'encoded', // use
'Return Get to do list'); // documentation
function GetMyConnection() {
global $InputArray;
$dbase_link = mysql_connect($InputArray['host'],$InputArray['mysql_user'],$InputArray['mysql_password']);
//check if connected
if (!$dbase_link) {
die("Can not connect: " . mysql_error());
}
//return $this->myconn;
//http://se1.php.net/manual/en/function.mysql-create-db.php
$dbase_select = mysql_select_db($InputArray['mysql_dbase']);
if (empty($dbase_select)) {
$sql = "CREATE DATABASE IF NOT EXISTS ".$InputArray['mysql_dbase']."\n";
if (mysql_query($sql)) {
echo "Database: " . $InputArray['mysql_dbase'] . " was created succesfully\n";
}
else {
echo "Error creating database: " . mysql_error() . "\n";
}
}
$dbase_select = mysql_select_db($InputArray['mysql_dbase']);
$sql = "CREATE TABLE IF NOT EXISTS ".$InputArray['mysql_dbase_table']." (
`id` int(11) NOT NULL AUTO_INCREMENT,
`acro` varchar(25) NOT NULL,
`time` varchar(25) NOT NULL,
`date` varchar(25) NOT NULL,
`note` varchar(1024) NOT NULL,
`prio` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
$create = mysql_query($sql);
if (!$create) {
echo "Error creating table: " . mysql_error() . "\n";
}
}// End of Function GetMyConnection
function closeConnection() {
$terminate = mysql_close();
if ($terminate) {
echo "Connection terminated\n";
}
else {
echo "Error terminating connection: " . mysql_error() . "\n";
}
}//End of function closeConnection
// create the function
function GetTodoList($acro) {
global $InputArray;
GetMyConnection();
if (!$acro) {
return new soap_fault('Client', '', 'No data received!');
}
else {
$dbase_select = mysql_select_db($InputArray['mysql_dbase']);
$get = mysql_query("SELECT * FROM " . $InputArray['mysql_dbase_table'] . " WHERE `acro` = '" . $acro . "'");
if($get === FALSE) {
echo "Could not retrieve data from: " . $InputArray['mysql_dbase_table'] . " due to: " . mysql_error() . "\n";
}
else {
while($total = mysql_fetch_array($get)) {
$Data[] = array('id' => $total['id'],
'acro' => $total['acro'],
'time' => $total['time'],
'date' => $total['date'],
'note' => $total['note'],
'prio' => $total['prio']);
}
}
}
return $Data;
closeConnection();
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
exit();
?>
Your URL for the SOAP is trying to access a local file path rather than a URL
If you open the URL you've specified in a browser you should get back a (possibly large) chunk of XML. I can almost guarantee that you would get nothing apart from a 404 error
For the SOAP connection you have to use the URL specified by the webserver rather than a local file path (unless you replace http:// with file:/// - that may work).
If your webserver exposes a URL (e.g., http://localmachine) and the WSDL is hosted in a subfolder (e.g., soapstuff) then the URL you would need to enter into the $client=new soapclient line would be something like http://localmachine/soapstuff?wsdl
I have a html form where name and email address are getting collected. I try to submit these informations to a GetResponse list using this script:
<?php
function mytheme_save_to_getresponse($form)
{
require_once 'jsonRPCClient.php';
$api_key = 'myAPIkey';
$api_url = 'http://api2.getresponse.com';
$client = new jsonRPCClient($api_url);
$result = NULL;
try {
$result = $client->get_campaigns(
$api_key,
array (
# find by name literally
'name' => array ( 'EQUALS' => 'testlist' )
)
);
}
catch (Exception $e) {
# check for communication and response errors
# implement handling if needed
die($e->getMessage());
}
$campaigns = array_keys($result);
$CAMPAIGN_ID = array_pop($campaigns);
$subscriberEmail = $_GET['email'];
try {
$result = $client->add_contact(
$api_key,
array (
'campaign' => $CAMPAIGN_ID,
'name' => $subscriberName,
'email' => $subscriberEmail,
'cycle_day' => '0'
)
);
}
catch (Exception $e) {
# check for communication and response errors
# implement handling if needed
die($e->getMessage());
}
}
?>
The script doesn't show any errors but GetResponse is not saving the lead to my list. Am I doing something wrong?
Thanks
James
If u are getting a response as [queued]=>1 then your script is working fine..
It will be added to your contact only after a validation/confirmation of entered email
$subscriberEmail will recieve a confirmation email...after the user click on the link contact will get added
This line is wrong:
'name' => $subscriberName,
because you have undefined variable and post it to then GetResponse API 'name' params without value so GetResponse API return Invalid params.
Change to:
$subscriberName => "Some_test_name", // for test only
In this line:
$subscriberEmail = $_GET['email'];
you should set some email in GET table maybe for test just change to:
$subscriberEmail = "test#domain.com"; // or sth like this.
Last idea is var_dump $result variable then you see response from GetResponse API
$result = null; // before try {
var_dump($result); // before end of function } ?>
Your code is looks good and You have to set the call back url for error handling