Nourah
Nourah

Reputation: 21

how to use TextMagic service with saved phone number in php

I would like to use TextMagic service for send sms messages to saved phone in database, i tried difference of methods but not working.

$y = mysql_query(" SELECT * FROM customer WHERE account_num = '$a' ");
if (mysql_num_rows($y) > 0) {
    $row1 = mysql_fetch_array($y);
    $a1 = $row1['phone_num'];

    $api = new TextMagicAPI(array(
        "username" => "***", 
        "password" => "***"
    ));
    $phone = array('$a1');
    $text = "hello ";
    $results = $api->send($text, $phone, true);
}

how can i hold this problem?

Upvotes: 0

Views: 171

Answers (1)

Berriel
Berriel

Reputation: 13611

I'm not sure if this is the problem, but: (suppose $a1 = 999)

$phone = array('$a1'); // array(1) { [0]=> string(3) "$a1" } 

is different than

$phone = array("$a1"); // array(1) { [0]=> string(3) "999" } 

and different than

$phone = array($a1); // array(1) { [0]=> int(999) }

Based on this, looks like the 3rd is the correct option.

Upvotes: 1

Related Questions