public function transcribe() { $this->prepareClient(); $response = $this->httpClient->setMethod(HttpRequest::METHOD_POST)->setRawBody(File_get_contents($this->getFileName()))->setOptions(array('sslverifypeer' => false, 'sslcapath' => '/etc/ssl/cert')); // ->setOptions(array('sslverifypeer'=> false)); $response = $this->httpClient->send(); //$voiceResults = explode("\n",$response->getContent()); //return $voiceResults[0]; return $this->httpClient->getLastRawResponse(); //echo $this->httpClient->getLastRawRequest(); //echo PHP_EOL . $response->getBody() . PHP_EOL; }
/** * Constructor of the object. * Generates the table for ANSEL to Unicode mapping. * @param String $conversionFile The name of the mapping file made by Heiner Eichmann. * The file can be downloaded FROM this URL: * http://www.heiner-eichmann.de/gedcom/ans2uni.con.zip */ public function __construct($conversion_file = 'ans2uni.con') { $temp_ini_file = 'mappings.ini'; // Name of temporary ini file if (File_exists($conversion_file)) { // Load file contents, convert into well-formed ini file for later parsing. // This is done because the original mapping file cannot be parsed by the // PHP function parse_ini_file. $file_contents = File_get_contents($conversion_file, 'FILE_BINARY'); // Load contents $file_contents = $this->strip_comments($file_contents, '#'); // Strip comments File_put_contents($temp_ini_file, $file_contents); // Save contents // Get ini contents $map = Parse_ini_file($temp_ini_file); // Parse ini file // Go through map to split up the mappings that contain more characters in the key, // so that mappings with one character goes into $this->mapping[1], those with two // characters goes to $this->mapping[2] etc. foreach ($map as $key => $value) { $characters = explode('+', $key); // Split string where '+' occurrs $num_chars = count($characters); // count number of characters $this->_mapping[$num_chars][Strtolower($key)] = $value; // Put mapping in right place } // Delete temporary ini file efterwards if exists if (File_exists($temp_ini_file)) { Unlink($temp_ini_file); } } else { echo '<p>No mapping file with name ' . $conversion_file . ' exists. Download this file ' . 'from <a href="http://www.heiner-eichmann.de/gedcom/ans2uni.con.zip">here</a>.'; } }