I'm getting a 500 internal error response when I try to retrieve data via SOAP.
What I have that's working and not giving me 500 internal error:
<?php
$client = new SoapClient('http://example.com/api/v2_soap/?wsdl');
$session = $client->login('xxx', 'xxx');
$complexFilter = array(
'complex_filter' => array(
array(
'key' => 'type',
'value' => array('key' => 'in', 'value' => 'simple,configurable')
)
)
);
$result = $client->catalogProductList($session, $complexFilter);
foreach ($result as $key => $value) {
$id = $value->product_id;
echo $id;
// productPrices($id); <-- this issue causes the error.
}
?>
When I then try to call a funtion in the foreach loop (see comment above):
function productPrices($id){
$client = new SoapClient('http://example.com/api/soap/?wsdl');
$session = $client->login('xxx', 'xxx');
$att = array("visibility","sku","special_price", "price");
$arguments = array( $id, NULL, $att);
$resultPrice = $client->call($session, 'catalog_product.info', $arguments);
echo $resultPrice['visibility'].",".$resultPrice['sku'].",".$resultPrice['special_price'].",".$resultPrice['price'];
}
The response I get from the server is now internal error 500. I have maximum 90 sku's/product ids.
Anyone know what the error might be?
Best Answer
Untested but something like this should work: