ShivaGupta Posted July 9, 2013 Share Posted July 9, 2013 (edited) i am new in php n dont have enough since to solve some provlemes myself.i am working with php using some examples and littile Knowledgebut its imported for me .so plz help me .sorry for bed english. i have this ocr class <?php $client = new SoapClient("http://www.ocrwebservice.com/services/OCRWebService.asmx?WSDL" , array("trace"=>1, "exceptions"=>1) ); $params = new StdClass(); $params->user_name = "example"; $params->license_code = "xxxxx-xxxxx-xxxxx-cccccc"; $inimage = new StdClass(); $image = "xxxxx.png"; $handle = fopen("$image", 'r'); $card_image = fread($handle, filesize($image)); fclose($handle); $inimage->fileName = $image; $inimage->fileData = $card_image; $params->OCRWSInputImage = $inimage; $settings = new StdClass(); $settings->ocrLanguages = array("ENGLISH"); $settings->outputDocumentFormat = "TXT"; $settings->convertToBW = TRUE; $settings->getOCRText = TRUE; $settings->createOutputDocument = FALSE; $settings->multiPageDoc = FALSE; $settings->ocrWords = FALSE; $params->OCRWSSetting = $settings; try { $result = $client->OCRWebServiceRecognize($params); } catch (SoapFault $fault) { print($client->__getLastRequest()); print($client->__getLastRequestHeaders()); } var_dump($result); print("Done"); ?> and here is their output object(stdClass)#5 (1) { ["OCRWSResponse"]=> object(stdClass)#6 (2) { ["ocrText"]=> object(stdClass)#7 (1) { ["ArrayOfString"]=> object(stdClass)#8 (1) { ["string"]=> string(9) "VR eP gT " } } ["ocrWSWords"]=> object(stdClass)#9 (0) { } } } Done i dont understand how to get string data "VR eP gT " frm output and save as text file.so plz give me a hint or a example. Edited July 9, 2013 by ShivaGupta Quote Link to comment Share on other sites More sharing options...
avshelestov Posted July 10, 2013 Share Posted July 10, 2013 Hello. $result->string ??? Quote Link to comment Share on other sites More sharing options...
cpd Posted July 10, 2013 Share Posted July 10, 2013 $result->OCRWSResponse->ocrText->ArrayOfString->string Quote Link to comment Share on other sites More sharing options...
ShivaGupta Posted July 14, 2013 Author Share Posted July 14, 2013 i want to redirecting output(string) to result.txt.plz help again thank u Quote Link to comment Share on other sites More sharing options...
ShivaGupta Posted July 14, 2013 Author Share Posted July 14, 2013 $result->OCRWSResponse->ocrText->ArrayOfString->string i reealy dont understand where edit .have error if edit like this Catchable fatal error: Object of class stdClass could not be converted to string in /home/content/65/11169265/html/8/index.php on line 47 help me plz Quote Link to comment Share on other sites More sharing options...
ShivaGupta Posted July 15, 2013 Author Share Posted July 15, 2013 (edited) Hello. $result->string ??? i try with this hint my level but not susses .need more help for get that content n save as text. Beginner with beginner question so better if anyoned reply with edited code. regards Edited July 15, 2013 by ShivaGupta Quote Link to comment Share on other sites More sharing options...
Solution cpd Posted July 15, 2013 Solution Share Posted July 15, 2013 What does var_dump($result->OCRWSResponse->ocrText->ArrayOfString); give? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.