private function sendRequest ( $data ) {
		// Build the post data
		$data = array_merge($data, array('username' => $this->nx_key, 'password' => $this->nx_secret));
		$post = '';
		foreach($data as $k => $v){
			$post .= "&$k=$v";
		}

		// If available, use CURL
		if (function_exists('curl_version')) {

			$to_nexmo = curl_init( $this->nx_uri );
			curl_setopt( $to_nexmo, CURLOPT_POST, true );
			curl_setopt( $to_nexmo, CURLOPT_RETURNTRANSFER, true );
			curl_setopt( $to_nexmo, CURLOPT_POSTFIELDS, $post );

			if (!$this->ssl_verify) {
				curl_setopt( $to_nexmo, CURLOPT_SSL_VERIFYPEER, false);
			}

			$from_nexmo = curl_exec( $to_nexmo );
			curl_close ( $to_nexmo );

		} elseif (ini_get('allow_url_fopen')) {
			// No CURL available so try the awesome file_get_contents

			$opts = array('http' =>
				array(
					'method'  => 'POST',
					'header'  => 'Content-type: application/x-www-form-urlencoded',
					'content' => $post
				)
			);
			$context = stream_context_create($opts);
			$from_nexmo = file_get_contents($this->nx_uri, false, $context);

		} else {
			// No way of sending a HTTP post :(
			return false;
		}

		
		return $this->nexmoParse( $from_nexmo );
	 
	}
private function sendRequest ( $data ) {
		// Build the post data
		$data = array_merge($data, array('username' => $this->nx_key, 'password' => $this->nx_secret));
		$post = '';
		foreach($data as $k => $v){
			$post .= "&$k=$v";
		}

		// If available, use CURL
		if (function_exists('curl_version')) {

			$to_nexmo = curl_init( $this->nx_uri );
			curl_setopt( $to_nexmo, CURLOPT_POST, true );
			curl_setopt( $to_nexmo, CURLOPT_RETURNTRANSFER, true );
			curl_setopt( $to_nexmo, CURLOPT_POSTFIELDS, $post );

			if (!$this->ssl_verify) {
				curl_setopt( $to_nexmo, CURLOPT_SSL_VERIFYPEER, false);
			}

			$from_nexmo = curl_exec( $to_nexmo );
			curl_close ( $to_nexmo );

		} elseif (ini_get('allow_url_fopen')) {
			// No CURL available so try the awesome file_get_contents

			$opts = array('http' =>
				array(
					'method'  => 'POST',
					'header'  => 'Content-type: application/x-www-form-urlencoded',
					'content' => $post
				)
			);
			$context = stream_context_create($opts);
			$from_nexmo = file_get_contents($this->nx_uri, false, $context);

		} else {
			// No way of sending a HTTP post :(
			return false;
		}

		
		return $this->nexmoParse( $from_nexmo );
	 
	}
private function sendRequest ( $ data ) { // Build the post data
 $ data = array_merge ( $ data , array ( 'username' => $ this -> nx_key , 'password' => $ this -> nx_secret ) ) ; $ post = '' ; foreach ( $ data as $ k => $ v ) { $ post .= "&$k=$v" ; } // If available, use CURL
 if ( function_exists ( 'curl_version' ) ) { $ to_nexmo = curl_init ( $ this -> nx_uri ) ; curl_setopt ( $ to_nexmo , CURLOPT_POST , true ) ; curl_setopt ( $ to_nexmo , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ to_nexmo , CURLOPT_POSTFIELDS , $ post ) ; if ( ! $ this -> ssl_verify ) { curl_setopt ( $ to_nexmo , CURLOPT_SSL_VERIFYPEER , false ) ; } $ from_nexmo = curl_exec ( $ to_nexmo ) ; curl_close ( $ to_nexmo ) ; } elseif ( ini_get ( 'allow_url_fopen' ) ) { // No CURL available so try the awesome file_get_contents
 $ opts = array ( 'http' => array ( 'method' => 'POST' , 'header' => 'Content-type: application/x-www-form-urlencoded' , 'content' => $ post ) ) ; $ context = stream_context_create ( $ opts ) ; $ from_nexmo = file_get_contents ( $ this -> nx_uri , false , $ context ) ; } else { // No way of sending a HTTP post :(
 return false ; } return $ this -> nexmoParse ( $ from_nexmo ) ; }
Prepare and send a new message.
Prepare and send a new message .