<?php

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

	$CONNECT = curl_init();
////http://api.farsireader.com/ArianaCloudService/ReadTextGET?APIKey={KEY}&Text={TEXT}&Speaker={SPEAKER}&Format={FORMAT}&GainLevel={GAIN}&PitchLevel={PITCH}&PunctuationLevel={PUNCTUATION}&SpeechSpeedLevel={SPEED}&ToneLevel={TONE}
	$data_string = '{"Text":"'.$arianatext.'",
	"Speaker":"Female1",
	"PitchLevel":"0",
	"PunctuationLevel":"0",
	"SpeechSpeedLevel":"0",
	"ToneLevel":"0",
	"GainLevel":"0",
	"BeginningSilence":"0",
	"EndingSilence":"0",
	"Username":"saeed200995@yahoo.com",
	"Password":"123456",
	"Format":"wav/8/m"}';
						
	$ch = curl_init('http://api.farsireader.com/ArianaCloudService/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.wav';
	$handle = fopen(trim($outputfilename), "wb");
	fwrite($handle, $result);
	fclose($handle);
	
	curl_close($ch);

?>
