用Webservice接口导入产品分类

<?php
set_time_limit(0);
$proxy = new SoapClient('http://localhost/magento/index.php/api/soap/?wsdl');
$sessionId = $proxy->login('crazy', 'abcdef');
$allCategories = $proxy->call($sessionId, 'category.tree'); // Get all categories.
$selectedCategory = $allCategories['children'][0]; // Get the fisrt categories as parent category
// insert test
$newCategoryId = $proxy->call(
   $sessionId,
   'category.create',
   array(
         $selectedCategory['category_id'],
         array('name'=>'New Category Through Soap')
   )
);
// update test.
$newData = array('is_active'=>1);
$proxy->call($sessionId, 'category.update', array($newCategoryId, $newData, 'default'));
?>


上面的代码可以示例了如何导入导出Categories.
$proxy = new SoapClient('http://localhost/magento/index.php/api/soap/?wsdl');

指向你的magento soap服务的位置
$sessionId = $proxy->login('crazy', 'abcdef');

指定授权的用户名和密码。此用户名和密码是在后台的System->Webservice下事先配置好的

你可能感兴趣的:(PHP,webservice,SOAP)