I've got a Zarafa server and I want to access the mails and calendar entries via PHP MAPI interface.
I didn't find any thing out about this solution for PHP, only for high-programming languages like C++.
Do you know a description or an example of how to implement and use the MAPI interface in PHP to communicate and get data from Zarafa server?
You need to use php-mapi extension provided by zarafa
Take a look at below API for PHP-MAPI although it is very old one but it will give you a starting point
https://community.zarafa.com/php-ext/
Also you can clone this repo to look into some example scripts in php and python
https://github.com/zarafagroupware/zarafa-tools
Currently I'm able to access the calendar folder and get the standard information like subject, body and so on which are already defined, but if I want to get extras like start- or endtime or the location, they aren't in the response array. I also tried access strings like "PT_STRING8:PSETID_Appointment:0x8208", didn't work.
$contents_table = mapi_folder_getcontentstable($this->calendar);
$props = array();
// $props["entryid"] = PR_ENTRYID;
$props["subject"] = PR_SUBJECT;
$props["body"] = PR_BODY;
$props["start"] = "PT_SYSTIME:{00062002-0000-0000-C000-000000000046}:0x820d";
$props["dtstamp"] = PR_LAST_MODIFICATION_TIME;
$props["location"] = "PT_STRING8:{00062002-0000-0000-C000-000000000046}:0x8208";
/* location, start won't be displayed */
$prop_ids = getPropIdsFromStrings($this->user_store, $props);
$rows = mapi_table_queryallrows($contents_table, $prop_ids);
var_dump($rows);
so, how i'm able to read out the information where i've to write id string by myself ?
Thank you
EDIT :
Got it by checking whether I'm using default store or not and I've got an programming mistake in creating instance of class where I forgot to reset the store, so store was null and mapi_getIdsfromNames returned empty array
Related
I am trying to get a reply text message from Clickatell using their Rest API, when I call the parseReplyCallback function when their system posts to my page - it seems to be null or I am not sure how to get the variables it is returning. What I would like to do is have all of the variables returned insert into a SQL database so I can use it elsewhere.
I have tried quite a few things, using various styles of getting the variables such as $_POST, $results['text'], $results->text, and so forth each time I can't seem to get any information out of it. I can't just var_dump or anything because I can't see any backend or console so I am pretty much in the blind, hoping someone else is using this system and has it working fine.
require __DIR__.'/clickatell/src/Rest.php';
use clickatell\ClickatellException;
use clickatell\Rest;
$Rest = new Rest("j8VKw3sJTZuVfQGVC7jdhA");
// Incoming traffic callbacks (MO/Two Way callbacks)
$Rest->parseReplyCallback(function ($result) {
//mysqli_query($con,"INSERT INTO `SMSCHAT` (`text`) VALUES ('$result')");
$mesageId = mysqli_real_escape_string($con,$result['messageId']);
$text = mysqli_real_escape_string($con,$result['text']);
$replyMessageId = mysqli_real_escape_string($con,$result['replyMessageId']);
$to = mysqli_real_escape_string($con,$result['toNumber']);
$from = mysqli_real_escape_string($con,$result['fromNumber']);
$charset = mysqli_real_escape_string($con,$result['charset']);
$udh = mysqli_real_escape_string($con,$result['udh']);
$network = mysqli_real_escape_string($con,$result['network']);
$keyword = mysqli_real_escape_string($con,$result['keyword']);
$timestamp = mysqli_real_escape_string($con,$result['timestamp']);
//do mysqli_query
});
I'd like for it to break the result into individual variables (because I plan on doing other things such as an auto-reply, etc) and upload it to the SQL database scrubbed.
Either doesn't create the table entry or gives me a blank one altogether in that first test where I put the result in the text field.
From a Clickatell point of view, although we understand what you're asking - it's unfortunately outside the scope of support that we offer on our products.
If you would like more information on our REST API functionality, please feel free to find it here: https://www.clickatell.com/developers/api-documentation/rest-api-reply-callback/
If you don't succeed in setting up the callbacks, please feel free to log a support ticket here: https://www.clickatell.com/contact/contact-support/ and one of our team members will reach out and try to assist where possible.
I'm using php and outlook to send automatic emails. What I desire is to mention some emails on the CC.
After thousands of search, I did not found any answers.
Below my script :
com_load_typelib("outlook.application");
if (!defined("olMailItem")) {
define("olMailItem",0);
}
$outlook_Obj = new COM("outlook.application") or die("Unable to start Outlook");
$oMsg = $outlook_Obj->CreateItem(olMailItem);
$oMsg->Recipients->Add("jajaja#google.com");
I didn't find the documentation for PHP (it seems Microsoft didn't write it yet) but I found it for VBA here.
In my opinion, the relevant part is:
The following example creates the same MailItem object as the preceding example, and then changes the type of the Recipient object from the default ("To") to CC.
Set myItem = Application.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add ("Jon Grande")
myRecipient.Type = olCC
This sample looks like the code you wrote, so the Outlook VBA interface is surely the same interface for PHP.
Additionaly, you can read the documentation for the Type property (Recipient.Type Property (Outlook) where you can find that there are OlMailRecipientType constants: olBCC, olCC, olOriginator, or olTo.
But, I think you can't use the string "olCC" as is, if you refer to the (olmailrecipienttype documentation), you must use an integer value that corresponds to the "olCC" value.
In our case, "olCC" is 2.
So, if you use the same code as the VBA, but in PHP and use the previous documentation, it should look like this:
$myRecipient = $oMsg->Recipients->Add("jajaja#google.com");
$myRecipient->Type = 2;
I hope it'll help. I didn't test it.
Paul
I want to put my fortnite stats on my website HTML/CSS. I find this.
But I don't know php very good, so I need your help. Must I delete this: 'your_api_key' and put : your_api_key without the ' ' ?
And lines like this:
$this->auth = new Fortnite_Auth($this);
$this->challenges = new Fortnite_Challenges($this);
$this->leaderboard = new Fortnite_Leaderboard($this);
$this->items = new Fortnite_Items($this);
$this->news = new Fortnite_News($this);
$this->patchnotes = new Fortnite_PatchNotes($this);
$this->pve = new Fortnite_PVE($this);
$this->status = new Fortnite_Status($this);
$this->weapons = new Fortnite_Weapons($this);
$this->user = new Fortnite_User($this)
Must I modify something?
(here are some informations:
-user_id: 501b9f2dfda34249a2749467513172bf
-username: NoMaD_DEEPonion
-platform: pc
-windows: season 5
)
For all this code, I used xammp server (I hope it's good)
Thank you for your help
You should always quote '' your key/strings. So it would look like:
$api->setKey('123qwerty456');
$api->user->id('NoMaD_DEEPonion');
Please read their documentation. You're supposed to get an API key from them to get started. And you don't have to edit Client.php. You're supposed to include the files instead. Try including Autoloader.php, since it requires the necessary files.
XAMPP is alright for development, but not suitable for production/public. Good luck!
What #sykez wrote.
I personally use https://fortniteapi.com/ to get the data. They also have a sweet POSTMAN page with different requests https://documenter.getpostman.com/view/4499368/RWEjoGqD
At last. I am not really sure that this will be a good project to start learning PHP from. I really suggest that you get to understand the basics of PHP first before you jump into API calls, processing arrays and more.
I'm actually building a PHP bot that reads the youtube live streaming chat, and store in a Database the message that contains a specific keyword wrote by the users during the livestream. All the logic is in place, what is missing is the feedback on chat when the bot is "triggered".
I looked everywhere but seams the PHP documentation is missing, if you look inside the PHP Classes there is the public function insert, but there is no example at all on how to use it?
Someone know how to use it?
Should be something "simple" like: $result = $youtube->liveChatMessages->Insert($args); but I can't figure out on what args looks like.
HERE the only reference about the Insert method
Thanks to all for any suggestion on how to use it!
17/06/2018 edit Working Example
$liveChatMessage = new Google_Service_YouTube_LiveChatMessage();
$liveChatSnippet = new Google_Service_YouTube_LiveChatMessageSnippet();
$liveChatSnippet->setLiveChatId($liveChatID);
$liveChatSnippet->setType("textMessageEvent");
$messageDetails = new Google_Service_YouTube_LiveChatTextMessageDetails();
$messageDetails->setMessageText("Message to type in chat");
$liveChatSnippet->setTextMessageDetails($messageDetails);
$liveChatMessage->setSnippet($liveChatSnippet);
$videoCommentInsertResponse = $youtube->liveChatMessages->insert('snippet', $liveChatMessage);
I have somewhat of a knowledge of the PHP coding language and I would like to connect the Campaign Monitor API(Link) with my website, so that when the user enters something into the form on my site it will add it to the database on the Campaign Monitor servers. I found the PHP code example zip file, but it contains like 30 files, and I have no idea where to begin.
Does anyone know of a tutorial anywhere that explains how to connect to the API in a step-by-step manner? The code files by themselves include to much code that I may not need for simply connecting to the database and adding and deleting users, since I only want to give the user the power to add and delete users from the Mailing List.
This actually looks pretty straightforward. In order to use the API, you simply need to include() the CMBase.php file that is in that zip file.
Once you've included that file, you can create a CampaignMonitor object, and use it to access the API functions. I took this example out of one of the code files in there:
require_once('CMBase.php');
$api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$client_id = null;
$campaign_id = null;
$list_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$cm = new CampaignMonitor( $api_key, $client_id, $campaign_id, $list_id );
//This is the actual call to the method, passing email address, name.
$result = $cm->subscriberAdd('joe#notarealdomain.com', 'Joe Smith');
You can check the result of the call like this (again taken from their code examples):
if($result['Result']['Code'] == 0)
echo 'Success';
else
echo 'Error : ' . $result['Result']['Message'];
Since you're only interested in adding a deleting users from a mailing list, I think the only two API calls you need to worry about are subscriberAdd() and subscriberUnsubscribe():
$result = $cm->subscriberAdd('joe#notarealdomain.com', 'Joe Smith');
$result = $cm->subscriberUnsubscribe('joe#notarealdomain.com');
Hope that helps. The example files that are included in that download are all singular examples of an individual API method call, and the files are named in a decent manner, so you should be able to look at any file for an example of the corresponding API method.