2012-08-13 168 views
0

我打電話給OCRWebservice.com &收到這樣PHP無法解析的響應對象

object(stdClass)#5 (1) { 
["OCRWSResponse"]=> 
object(stdClass)#6 (2) { 
    ["ocrText"]=> 
     object(stdClass)#7 (1) { 
      ["ArrayOfString"]=> 
       object(stdClass)#8 (1) { 
        ["string"]=> 
          string(109) "......,......,- PHYSICIANS HAVE BIGGER STAKE IN PATIENT, TOTAL CARE UNDER MEDICARE ACOs AROUNDTHEINDUSTRY " 
       } 
     } 
    ["ocrWSWords"]=> 
     object(stdClass)#9 (0) { 
     } 
} 
} 

object(stdClass)#10 (1) { 
["OCRWSResponse"]=> 
    object(stdClass)#11 (2) { 
     ["ocrText"]=> 
      object(stdClass)#12 (1) { 
       ["ArrayOfString"]=> 
        object(stdClass)#13 (1) { 
         ["string"]=> 
         string(21) "AROUNDTHEINDUSTRY 10 " 
        } 
      } 
     ["ocrWSWords"]=> 
      object(stdClass)#14 (0) { 
     } 
} 
} 

的響應,我無法分析此爲$響應 - > OCRWSResponse-> ocrText。我需要讀取ocrText中的字符串值。

似乎有多個OCRWSResponse返回。我需要循環他們&得到所有的ocrText。有人可以幫助嗎?

+1

[你嘗試過什麼(http://www.whathaveyoutried.com)? – Jon 2012-08-13 11:49:42

+1

轉儲不夠清楚嗎? – Shubham 2012-08-13 11:56:21

+1

你只給出了問題本身的答案。循環響應並獲取數據。 – Poonam 2012-08-13 11:58:33

回答

1

試試這個:

<?php 
// $response is the response 
echo $response->OCRWSResponse->ocrText->ArrayOfString->string; 
?>