private function executeQuery($url, array $data = array(), array $extra_result_data = array())
    {
        $request = array(
            'outboundSMSMessageRequest' => array(
                'address'                => array(sprintf('tel:%s', $data['to'])),
                'senderAddress'          => sprintf('tel:%s', $data['from']),
                'outboundSMSTextMessage' => array(
                    'message' => $data['text']
                ),
            ),
        );

        $content = $this->getAdapter()->getContent($url, 'POST', $this->getHeaders(), json_encode($request));

        if (null == $content) {
            $results = $this->getDefaults();
        }

        if (is_string($content)) {
            $content = json_decode($content, true);
            $results['id'] = $content['outboundSMSMessageRequest']['clientCorrelator'];

            switch ($content['outboundSMSMessageRequest']['deliveryInfoList']['deliveryInfo'][0]['deliveryStatus']) {
                case 'DeliveredToNetwork':
                    $results['status'] = ResultInterface::STATUS_SENT;
                    break;
                case 'DeliveryImpossible':
                    $results['status'] = ResultInterface::STATUS_FAILED;
                    break;
            }
        }

        return array_merge($results, $extra_result_data);
    }
private function executeQuery($url, array $data = array(), array $extra_result_data = array())
    {
        $request = array(
            'outboundSMSMessageRequest' => array(
                'address'                => array(sprintf('tel:%s', $data['to'])),
                'senderAddress'          => sprintf('tel:%s', $data['from']),
                'outboundSMSTextMessage' => array(
                    'message' => $data['text']
                ),
            ),
        );

        $content = $this->getAdapter()->getContent($url, 'POST', $this->getHeaders(), json_encode($request));

        if (null == $content) {
            $results = $this->getDefaults();
        }

        if (is_string($content)) {
            $content = json_decode($content, true);
            $results['id'] = $content['outboundSMSMessageRequest']['clientCorrelator'];

            switch ($content['outboundSMSMessageRequest']['deliveryInfoList']['deliveryInfo'][0]['deliveryStatus']) {
                case 'DeliveredToNetwork':
                    $results['status'] = ResultInterface::STATUS_SENT;
                    break;
                case 'DeliveryImpossible':
                    $results['status'] = ResultInterface::STATUS_FAILED;
                    break;
            }
        }

        return array_merge($results, $extra_result_data);
    }
private function executeQuery ( $ url , array $ data = array ( ) , array $ extra_result_data = array ( ) ) { $ request = array ( 'outboundSMSMessageRequest' => array ( 'address' => array ( sprintf ( 'tel:%s' , $ data [ 'to' ] ) ) , 'senderAddress' => sprintf ( 'tel:%s' , $ data [ 'from' ] ) , 'outboundSMSTextMessage' => array ( 'message' => $ data [ 'text' ] ) , ) , ) ; $ content = $ this -> getAdapter ( ) -> getContent ( $ url , 'POST' , $ this -> getHeaders ( ) , json_encode ( $ request ) ) ; if ( null == $ content ) { $ results = $ this -> getDefaults ( ) ; } if ( is_string ( $ content ) ) { $ content = json_decode ( $ content , true ) ; $ results [ 'id' ] = $ content [ 'outboundSMSMessageRequest' ] [ 'clientCorrelator' ] ; switch ( $ content [ 'outboundSMSMessageRequest' ] [ 'deliveryInfoList' ] [ 'deliveryInfo' ] [ 0 ] [ 'deliveryStatus' ] ) { case 'DeliveredToNetwork' : $ results [ 'status' ] = ResultInterface :: STATUS_SENT ; break ; case 'DeliveryImpossible' : $ results [ 'status' ] = ResultInterface :: STATUS_FAILED ; break ; } } return array_merge ( $ results , $ extra_result_data ) ; }
do the query
do the query