2

Possible Duplicate:
Debugging PHP SOAP call

This is first time I am using soap api and I have prepared this script but I got the
"Cannot use object of type stdClass as array" error, please tell me the right method to retrieve data

<?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->login( $mage_user, $mage_api_key );
print_r($session_id);
 ?>


<?php 
$resources = $soap->resources( $session_id );
if( is_array( $resources ) && !empty( $resources )) { ?> 
<?php foreach( $resources as $resource ) { ?> 
<h1><?php echo $resource['title']; ?></h1> 
Name: <?php echo $resource['name']; ?><br/>
Aliases: <?php echo implode( ',', $resource['aliases'] ); ?> 
<table> 
    <tr> 
        <th>Title</th> 
        <th>Path</th> 
        <th>Name</th> 
    </tr> 
    <?php foreach( $resource['methods'] as $method ) { ?> 
    <tr> 
        <td><?php echo $method['title']; ?></td> 
        <td><?php echo $method['path']; ?></td> 
        <td><?php echo $method['name']; ?></td> 
        <td><?php echo implode( ',', $method['aliases'] ); ?></td> 
    </tr> 
    <?php } ?> 
</table> 
<?php } ?> 
<?php } ?> 
Community
  • 1
  • 1
Rohit Goel
  • 3,396
  • 8
  • 56
  • 107

1 Answers1

0

On what row do you get error?

http://php.net/manual/ru/function.get-object-vars.php

$array = get_object_vars($object);
freento
  • 2,939
  • 4
  • 29
  • 53