Having trouble creating Gateway module for SMS Framework

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
EthanT's picture

Sorry guys, but I'm a dummy. I've tried to create a module for the eztexting gateway (http://www.eztexting.com/developers/), and have not been succesful. Can anyone tell me what I'm doing wrong? Thanks in advance.

<?php
// $Id: sms_eztexting.module,v 1.4.2.3 2008/10/09 17:26:25 diggersf Exp $

/**
* @file
* Adds support for sending SMS messages using the EZTexting gateway.
*/

/**
* Implementation of hook_gateway_info().
*/
function sms_eztexting_gateway_info() {
return array(
'sms_eztexting_gateway' => array(
'name' => 'EZ Texting',
'send' => 'sms_eztexting_send',
'receive' => TRUE,
'configure form' => 'sms_eztexting_admin_form',
'send form' => 'sms_eztexting_send_form',
),
);
}

$form['sms_eztexting_ssl'] = array(
'#type' => 'checkbox',
'#title' => t('Use SSL Encyption'),
'#description' => t('Drupal\'s built-in HTTP client only supports SSL on PHP 4.3 compiled with OpenSSL.'),
'#default_value' => $configuration['sms_eztexting_ssl'],
);

function sms_eztexting_admin_form($configuration) {
$form['sms_eztexting_user'] = array(
'#type' => 'textfield',
'#title' => t('User'),
'#description' => t('The username of your EZ Texting account.'),
'#size' => 40,
'#maxlength' => 255,
'#default_value' => $configuration['sms_eztexting_user'],
);

$form['sms_eztexting_password'] = array(
'#type' => 'textfield',
'#title' => t('Pass'),
'#description' => t('The current password on your EZ Texting account.'),
'#size' => 30,
'#maxlength' => 64,
'#default_value' => $configuration['sms_eztexting_password'],
);

return $form;
}

/**
* Returns custom additions to be added to the send forms
*/
function sms_eztexting_send_form() {
$form['country'] = array(
'#type' => 'select',
'#title' => t('Country'),
'#multiple' => FALSE,
'#options' => sms_eztexting_country_codes(FALSE),
'#default_value' => -1,
);
return $form;
}

function sms_eztexting_send($number, $message, $options) {
$number = $options['Country'] . $number;
return sms_eztexting_command('sendmsg', array('PhoneNumber' => $number, 'Message' => $message));
}
{

if ($config == NULL) {
$config = $gateway['configuration'];
}

if ($config['sms_eztexting_ssl']) {
$scheme = 'https';
}
else {
$scheme = 'http';
}

$http_result = drupal_http_request($scheme .'://app.eztexting.com/api/sending/'. $command .'?'. $query);
}

function sms_eztexting_country_codes() {
return array(
93 => "Afghanistan",
355 => "Albania",
213 => "Algeria",
376 => "Andorra",
244 => "Angola",
1264 => "Anguilla",
1268 => "Antigua & Barbuda",
54 => "Argentina",
374 => "Armenia",
297 => "Aruba",
61 => "Australia",
43 => "Austria",
994 => "Azerbaijan",
1242 => "Bahamas",
973 => "Bahrain",
880 => "Bangladesh",
1246 => "Barbados",
375 => "Belarus",
32 => "Belgium",
501 => "Belize",
229 => "Benin",
1441 => "Bermuda",
975 => "Bhutan",
591 => "Bolivia",
387 => "Bosnia-Herzegovina",
267 => "Botswana",
55 => "Brazil",
1284 => "British Virgin Islands",
673 => "Brunei",
359 => "Bulgaria",
226 => "Burkina Faso",
257 => "Burundi",
855 => "Cambodia",
237 => "Cameroon",
34 => "Canary Islands",
238 => "Cape Verde",
1345 => "Cayman Islands",
236 => "Central African Republic",
235 => "Chad",
56 => "Chile",
86 => "China",
57 => "Colombia",
269 => "Comoros",
242 => "Congo",
243 => "Democratic Republic Congo",
682 => "Cook Islands",
385 => "Croatia",
53 => "Cuba",
357 => "Cyprus",
420 => "Czech Republic",
45 => "Denmark",
253 => "Djibouti",
1767 => "Dominica",
670 => "East Timor",
593 => "Ecuador",
20 => "Egypt",
503 => "El Salvador",
240 => "Equatorial Guinea",
372 => "Estonia",
251 => "Ethiopia",
500 => "Falkland Islands",
298 => "Faroe Islands",
679 => "Fiji",
358 => "Finland",
33 => "France",
594 => "French Guiana",
689 => "French Polynesia",
241 => "Gabon",
220 => "Gambia",
995 => "Georgia",
49 => "Germany",
233 => "Ghana",
350 => "Gibraltar",
881 => "Global Mobile Satellite",
30 => "Greece",
299 => "Greenland",
1473 => "Grenada",
590 => "Guadeloupe",
1671 => "Guam",
502 => "Guatemala",
224 => "Guinea",
592 => "Guyana",
509 => "Haiti",
504 => "Honduras",
852 => "HongKong",
36 => "Hungary",
354 => "Iceland",
91 => "India",
62 => "Indonesia",
98 => "Iran",
964 => "Iraq",
353 => "Ireland",
972 => "Israel",
39 => "Italy / Vatican City State",
225 => "Ivory Coast",
1876 => "Jamaica",
81 => "Japan",
962 => "Jordan",
254 => "Kenya",
82 => "Korea (South)",
965 => "Kuwait",
996 => "Kyrgyzstan",
856 => "Lao",
371 => "Latvia",
961 => "Lebanon",
266 => "Lesotho",
231 => "Liberia",
218 => "Libya",
423 => "Liechtenstein",
370 => "Lithuania",
352 => "Luxembourg",
853 => "Macau",
389 => "Macedonia",
261 => "Madagascar",
265 => "Malawi",
60 => "Malaysia",
960 => "Maldives",
223 => "Mali",
356 => "Malta",
596 => "Martinique",
222 => "Mauritania",
230 => "Mauritius",
269 => "Mayotte Island (Comoros)",
52 => "Mexico",
373 => "Moldova",
377 => "Monaco (Kosovo)",
976 => "Mongolia",
382 => "Montenegro",
1664 => "Montserrat",
212 => "Morocco",
258 => "Mozambique",
95 => "Myanmar",
264 => "Namibia",
977 => "Nepal",
31 => "Netherlands",
599 => "Netherlands Antilles",
687 => "New Caledonia",
64 => "New Zealand",
505 => "Nicaragua",
227 => "Niger",
234 => "Nigeria",
47 => "Norway",
968 => "Oman",
92 => "Pakistan",
970 => "Palestine (+970)",
9725 => "Palestine (+9725)",
507 => "Panama",
675 => "Papua New Guinea",
595 => "Paraguay",
51 => "Peru",
63 => "Philippines",
48 => "Poland",
351 => "Portugal",
974 => "Qatar",
262 => "Reunion",
40 => "Romania",
7 => "Russia / Kazakhstan",
250 => "Rwanda",
1670 => "Saipan",
1684 => "Samoa (American)",
685 => "Samoa (Western)",
378 => "San Marino",
882 => "Satellite-Thuraya",
966 => "Saudi Arabia",
221 => "Senegal",
381 => "Serbia",
248 => "Seychelles",
232 => "Sierra Leone",
65 => "Singapore",
421 => "Slovakia",
386 => "Slovenia",
252 => "Somalia",
27 => "South Africa",
34 => "Spain",
94 => "Sri Lanka",
1869 => "St. Kitts And Nevis",
1758 => "St. Lucia",
1784 => "St. Vincent",
249 => "Sudan",
597 => "Suriname",
268 => "Swaziland",
46 => "Sweden",
41 => "Switzerland",
963 => "Syria",
886 => "Taiwan",
992 => "Tajikistan",
255 => "Tanzania",
66 => "Thailand",
228 => "Togo",
676 => "Tonga Islands",
1868 => "Trinidad and Tobago",
216 => "Tunisia",
90 => "Turkey",
993 => "Turkmenistan",
1649 => "Turks and Caicos Islands",
256 => "Uganda",
44 => "UK / Isle of Man / Jersey / Guernsey",
380 => "Ukraine",
971 => "United Arab Emirates",
598 => "Uruguay",
1 => "USA / Canada / Dominican Rep. / Puerto Rico",
998 => "Uzbekistan",
678 => "Vanuatu",
58 => "Venezuela",
84 => "Vietnam",
967 => "Yemen",
260 => "Zambia",
255 => "Zanzibar",
263 => "Zimbabwe",
);
}

Comments

I wish help

sanday's picture

Hi
I know its been a long time and maybe you are now working in some advance modules but i am working in the same project .
and have some issue like you.
Do you have any progress in your project .
thanks.