Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SMSNotifier server settings parameters
#7
Hi Joe,
added the variable initialization for i, though this code was running earlier when I was using a different sms service provider (that required less parameters).
can you help me with echoing result status or echo the url generated, so i can find where its going wrong? I am not able to echo anything out of this program. Here is how i am trying -
1. modify code
2. go to leads, select a lead and send sms (button).
3. hope for sms on phone / look for echo or print.

None of the 2 in step 3 shows up yet.

Hoping to hear soon.

thanks for being there all through  Shy
Code:
public function send($message, $tonumbers) {
$i = 0;
if(!is_array($tonumbers)) {
$tonumbers = array($tonumbers);
}

$params = $this->prepareParameters();

$params['text'] = $message;
$params['number'] = implode(',', $tonumbers);

$serviceURL = $this->getServiceURL(self::SERVICE_SEND);    
$httpClient = new Vtiger_Net_Client($serviceURL);
$response = $httpClient->doPost($params);    
$result['status'] = $response;
$responseLines = split("\n", $response);    

$results = array();
foreach($responseLines as $responseLine) {

$responseLine = trim($responseLine);    
if(empty($responseLine)) continue;

$result = array( 'error' => false, 'statusmessage' => '' );
if(preg_match("/ERRSad.*)/", trim($responseLine), $matches)) {
$result['error'] = true;
$result['to'] = $tonumbers[$i++];
$result['statusmessage'] = $matches[0]; // Complete error message
} else if(preg_match("/ID: ([^ ]+)TOSad.*)/", $responseLine, $matches)) {
$result['id'] = trim($matches[1]);
$result['to'] = trim($matches[2]);
$result['status'] = self::MSG_STATUS_PROCESSING;

} else if(preg_match("/ID: (.*)/", $responseLine, $matches)) {
$result['id'] = trim($matches[1]);
$result['to'] = $tonumbers[0];
$result['status'] = self::MSG_STATUS_PROCESSING;
}
$results[] = $result;
}    
return $results;
}
[color=#000080][b]Anil Purushothaman[/b][/color]
Reply


Messages In This Thread
RE: SMSNotifier server settings parameters - by anilp78 - 07-05-2019, 06:36 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)