Jump to content

Need help in php output.


ShivaGupta
Go to solution Solved by cpd,

Recommended Posts

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 

Knowledge

but 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 by ShivaGupta
Link to comment
Share on other sites

$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

Link to comment
Share on other sites

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 by ShivaGupta
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.