刚接触php就被一个问题难住了,查了几个小时也没能解决,来此求助各位前辈。
-------
在使用php xmlrpc协议向远程xmrpc服务器传送图片成功之后,会返回一个对象( Object ),对象中包含了多个元素,其中一个是url现在想获取这个url,怎样操作
-----------------
我试着用serialize把对象转换成字符串再用正则表达式匹配,不知道什么原因匹配不上……
然后把对象强制转换成数组,也只能转换一层…
--------------------------
返回的对象使用var_dump()的结果如下:想获取红色的url,谢谢object(xmlrpcresp)#15 (9) {
  ["val"] => object(xmlrpcval)#14 (3) {
    ["me"] => array(1) {
      ["struct"] => array(3) {
        ["file"] => object(xmlrpcval)#11 (3) {
          ["me"] => array(1) {
            ["string"] => string(9) "74748.jpg"
          }
          ["mytype"] => int(1)
          ["_php_class"] => NULL
        }
        ["url"] => object(xmlrpcval)#12 (3) {
          ["me"] => array(1) {
            ["string"] => string(58) "http://127.0.0.1/wp/wp-content/uploads/2011/12/7474884.jpg"
          }
          ["mytype"] => int(1)
          ["_php_class"] => NULL
        }
        ["type"] => object(xmlrpcval)#13 (3) {
          ["me"] => array(1) {
            ["string"] => string(10) "image/jpeg"
          }
          ["mytype"] => int(1)
          ["_php_class"] => NULL
        }
      }
    }
    ["mytype"] => int(3)
    ["_php_class"] => NULL
  }
  ["valtyp"] => string(10) "xmlrpcvals"
  ["errno"] => int(0)
  ["errstr"] => string(0) ""
  ["payload"] => NULL
  ["hdrs"] => array(6) {
    ["date"] => string(29) "Fri, 02 Dec 2011 06:35:43 GMT"
    ["server"] => string(32) "Apache/2.0.63 (Win32) PHP/5.2.14"
    ["x-powered-by"] => string(10) "PHP/5.2.14"
    ["connection"] => string(5) "close"
    ["content-length"] => string(3) "445"
    ["content-type"] => string(8) "text/xml"
  }
  ["_cookies"] => array(0) {
  }
  ["content_type"] => string(8) "text/xml"
  ["raw_data"] => string(633) "HTTP/1.1 200 OK
Date: Fri, 02 Dec 2011 06:35:43 GMT
Server: Apache/2.0.63 (Win32) PHP/5.2.14
X-Powered-By: PHP/5.2.14
Connection: close
Content-Length: 445
Content-Type: text/xml锘?lt;?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
      <struct>
  <member><name>file</name><value><string>74748.jpg</string></value></member>
  <member><name>url</name><value><string>http://127.0.0.1/wp/wp-content/uploads/2011/12/7474884.jpg</string></value></member>
  <member><name>type</name><value><string>image/jpeg</string></value></member>
</struct>
      </value>
    </param>
  </params>
</methodResponse>
"
}