Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot use object of type stdClass as array magento
    text
    copied!<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/3973979/debugging-php-soap-call">Debugging PHP SOAP call</a> </p> </blockquote> <p>This is first time I am using soap api and I have prepared this script but I got the<br> "Cannot use object of type stdClass as array" error, please tell me the right method to retrieve data </p> <pre><code>&lt;?php // Magento login information $mage_url = 'http://localhost/magento//index.php/api/V2_soap?wsdl=1'; $mage_user = 'rohit'; $mage_api_key = '1234567890'; // Initialize the SOAP client $soap = new SoapClient( $mage_url ); // Login to Magento $session_id = $soap-&gt;login( $mage_user, $mage_api_key ); print_r($session_id); ?&gt; &lt;?php $resources = $soap-&gt;resources( $session_id ); if( is_array( $resources ) &amp;&amp; !empty( $resources )) { ?&gt; &lt;?php foreach( $resources as $resource ) { ?&gt; &lt;h1&gt;&lt;?php echo $resource['title']; ?&gt;&lt;/h1&gt; Name: &lt;?php echo $resource['name']; ?&gt;&lt;br/&gt; Aliases: &lt;?php echo implode( ',', $resource['aliases'] ); ?&gt; &lt;table&gt; &lt;tr&gt; &lt;th&gt;Title&lt;/th&gt; &lt;th&gt;Path&lt;/th&gt; &lt;th&gt;Name&lt;/th&gt; &lt;/tr&gt; &lt;?php foreach( $resource['methods'] as $method ) { ?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $method['title']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $method['path']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $method['name']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo implode( ',', $method['aliases'] ); ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;/table&gt; &lt;?php } ?&gt; &lt;?php } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload