<?php require 'vendor/autoload.php'; require_once 'app_setting.inc.php'; use ZendService\LiveDocx\MailMerge; error_log("validate triggerd"); // Setup client Podio::setup($client_id, $client_secret); // Turn on debugging Podio::$debug = true; // Authenticate the app Podio::authenticate('app', array('app_id' => $app_id, 'app_token' => $app_token)); switch ($_POST['type']) { case 'hook.verify': // Validate the webhook PodioHook::validate($_POST['hook_id'], array('code' => $_POST['code'])); case 'item.create': $item = PodioItem::get($_POST['item_id']); $temp_array = array(); foreach ($item->files as $fs) { $temp_array[] = $fs; if ($fs->mimetype == 'application/msword') { //Get file name withour ext $no_ext = substr($fs->name, 0, strpos($fs->name, '.')); //Upload file to our server $fl = PodioFile::get($fs->file_id); $fc = $fl->get_raw(); file_put_contents($upload_path . $fs->name, $fc); //Part with convert files from doc(x) to pdf $mailMerge = new MailMerge(); $mailMerge->setUsername($user)->setPassword($password)->setService(MailMerge::SERVICE_FREE);
public function receive() { switch ($_POST['type']) { case 'hook.verify': \Podio::setup(Config::get('podio.client_id'), Config::get('podio.client_secret')); \Podio::authenticate_with_app(Config::get('podio.post_app_id'), Config::get('podio.post_app_token')); \PodioHook::validate($_POST['hook_id'], array('code' => $_POST['code'])); case 'item.create': $pb = new Postback(); $pb->data = serialize($_POST); $pb->pb_type = $_POST['type']; $pb->item_id = $_POST['item_id']; $pb->save(); case 'item.update': $pb = new Postback(); $pb->data = serialize($_POST); $pb->pb_type = $_POST['type']; $pb->item_id = $_POST['item_id']; $pb->save(); case 'item.delete': $pb = new Postback(); $pb->data = serialize($_POST); $pb->pb_type = $_POST['type']; $pb->item_id = $_POST['item_id']; $pb->save(); } return 'hey api received'; }