Tamer Zoubi @ Drupal 8


Drupal expert | Programmer

php

Customer Support via Twilio SMS with Zendesk v2

Recently I was challenged to integrate Twilio SMS channel via Zendesk. If you're not familiar with Zendesk, it's a helpdesk system that allows customers to create tickets by sending email which support staff can respond to and create certain workflows. More about Zendesk here.

For SMS part I decided to use Twilio since I am already familiar with their API. More about Twilio here.

Tags
php
twilio
zendesk

Send SMS from VoIP Drupal

Considering you configured your VoIP Drupal with one of the providers, here is the sample code snippet that sends "Hello world" SMS:

<?php
$number = '+1234567890123'; //Number to send SMS to. Must be in E.164 format.
$call = new VoipCall();
$call->setDestNumber($number);
$text = 'Hello from VoIP Drupal';
voip_text($text, $call);
?>

Pretty cool, right?

Tags
php
sms
VoIP Drupal

Check if a file exists in Amazon S3

If you are looking for a way to check if a file exists in Amazon S3 bucket using Amazon S3 PHP library, then probably this may help you.

Simplest way is to use function getObjectInfo()

<?php
//initiate the class
$s3 = new AmazonS3();
$info = $s3->getObjectInfo($bucket, $filename);
if ($info){
//File exists
}
else{
//File doesn't exists
}
?>

This function will return FALSE if $filename doesn't exists in Amazon S3 bucket.

Tags
php
Amazon S3

Open Drupal modules in Notepad++ using PHP markup

If you are working everyday with Drupal module development you know how frustrating can be that each time you open a module file its show in plaintext instead of in PHP format. Well there is a easy solution, open up your Notepad++ and go to Settings -> Style Configurator.

Depending on which language color syntax you want for the file extension, under Language, select the language.

Select php under Language.

Tags
notepad++
php
drupal module

PHP convert image to byte array

Recently I worked on integration between Drupal CMS with backend SOAP service and encountered a problem with saving image to the backend. The backend required image to be passed as byte array. Googling around I was suprised to find out answers like "I don't think PHP has such low level control..." or "change your backend service...". Eventually after not finding anything useful I decided to tackle the issue myself and soon I came up with a solution which is actually very easy.

Tags
Drupal 6
php
SOAP