<?php

 
	
	$serverAddress="192.168.1.1"; // Use Your Ariana Server IP
	$arianatext = "تست سرویس آریانا تاریخ میلادی " . date("Y/m/d H:i:s");

	$CONNECT = curl_init();

	$data_string = '{"Text":"'.$arianatext.'",
	"Speaker":"Female1",
	"PitchLevel":"0",
	"PunctuationLevel":"0",
	"SpeechSpeedLevel":"0",
	"ToneLevel":"0",
	"GainLevel":"0",
	"BeginningSilence":"0",
	"EndingSilence":"0",
	"Username":"test",
	"Password":"test",
	"Base64Encode":"0",
	"Quality":"normal"
	"Format":"mp3"}';
						
	$ch = curl_init('http://'.$serverAddress.':1385/ArianaRESTService/ReadText/');                                                                      
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
	curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
		'Content-Type: application/json',                                                                                
		'Content-Length: ' . strlen($data_string))                                                                       
	);                                                                                                                   

	$result = curl_exec($ch);

	
	$outputfilename = 'test.mp3';
	$handle = fopen(trim($outputfilename), "wb");
	fwrite($handle, $result);
	fclose($handle);
	
	curl_close($ch);

?>
