/** * Call soap api. * * @param string $resource * @param array $params * * @return array * * @throws NotConnectedException * @throws RestCallException */ public function call($resource, $params = null) { if ($this->isConnected()) { try { $stopWatch = new Stopwatch(microtime(true)); $stopWatch->start('prestashopSoapCall'); $response = $this->client->call($this->session, $resource, $params); $event = $stopWatch->stop('prestashopSoapCall'); $this->profiler->logCallDuration($event, $resource); } catch (\SoapFault $e) { if ($resource === 'core_prestashop.info' && $e->getMessage() === AbstractGuesser::PRESTASHOP_CORE_ACCESS_DENIED) { $response = ['prestashop_version' => AbstractGuesser::UNKNOWN_VERSION]; } elseif ($e->getMessage() === AbstractGuesser::PRESTASHOP_CORE_ACCESS_DENIED) { throw new RestCallException(sprintf('Error on Prestashop soap call to "%s" : "%s" Called resource : "%s" with parameters : %s.' . ' Soap user needs access on this resource. Please ' . 'check in your Prestashop webservice soap roles and ' . 'users configuration.', $this->clientParameters->getPrestashopUrl(), $e->getMessage(), $resource, json_encode($params)), $e->getCode(), $e); } else { throw new RestCallException(sprintf('Error on Prestashop soap call to "%s" : "%s". Called resource : "%s" with parameters : %s', $this->clientParameters->getPrestashopUrl(), $e->getMessage(), $resource, json_encode($params)), $e->getCode(), $e); } } if (is_array($response) && isset($response['isFault']) && $response['isFault']) { throw new RestCallException(sprintf('Error on Prestashop soap call to "%s" : "%s". Called resource : "%s" with parameters : %s.' . 'Response from API : %s', $this->clientParameters->getPrestashopUrl(), $e->getMessage(), $resource, json_encode($params), json_encode($response))); } return $response; } else { throw new NotConnectedException(); } }
public function demo_api() { $objClient = new SoapClient($this->wdsl, 'wsdl', FALSE, FALSE, FALSE, FALSE, 30, 60); $objClient->decode_utf8 = false; $result = $objClient->call('Fdt_tracking_list', array('b_ma_dvi' => '160', 'b_so_hieu' => '1212')); $items = $result['Fdt_tracking_listResult']['TrackingItem']; print_r($items); // $param = Array( // 'input' => $inputCall // ); // $result = $objClient->submit($param); }
/** * @param ActionInterface $action * @param bool $throwsException * * @return array|false * @throws \Exception */ public function call(ActionInterface $action, $throwsException = true) { try { $this->checkSecurity(); $result = $this->soapClient->call($this->sessionId, $action->getMethod(), $action->getArguments()); return $result; } catch (\Exception $e) { if ($throwsException) { throw $e; } return false; } }
public function testUnHold() { $session = $this->_prepare(); $client = new SoapClient("http://hackathon.dev/api/soap/?wsdl"); //soap handle try { print_r($client->call($session, 'sales_order.unhold', '100000094')); } catch (Exception $e) { //while an error has occured echo "==> Error: " . $e->getMessage(); //we print this } }
public function indexAction() { if (Mage::getStoreConfig('mobileassistant/mobileassistant_general/enabled')) { $isSecure = Mage::app()->getFrontController()->getRequest()->isSecure(); $validate_url = false; if ($isSecure) { if (Mage::getStoreConfig('web/secure/base_url') == Mage::getStoreConfig('web/secure/base_link_url')) { $validate_url = true; } } else { if (Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url')) { $validate_url = true; } } if ($validate_url) { $details = Mage::app()->getRequest()->getParams(); $user = $details['userapi']; $api_key = $details['keyapi']; $deviceToken = $details['token']; $flag = $details['notification_flag']; $device_type = $details['device_type']; $url = $details['magento_url'] . 'api/soap?wsdl'; try { $soap = new SoapClient($url); $session_id = $soap->login($user, $api_key); } catch (SoapFault $fault) { $result['error'] = $fault->getMessage(); $jsonData = Mage::helper('core')->jsonEncode($result); return Mage::app()->getResponse()->setBody($jsonData); } if ($session_id) { $data[] = array('user' => $user, 'key' => $api_key, 'devicetoken' => $deviceToken, 'session_id' => $session_id, 'notification_flag' => $flag, 'device_type' => $device_type, 'is_logout' => 0); $result = $soap->call($session_id, 'mobileassistant.create', $data); $jsonData = Mage::helper('core')->jsonEncode($result); return Mage::app()->getResponse()->setBody($jsonData); } } else { $result['error'] = $this->__('There seems some difference between the Based URL & Magento Based URL(on the store). Please check & if issue persists, Contact our Support Team.'); } } else { $result['error'] = $this->__('Please activate the Mobile Assistant Extension on the Magento Store.'); } $jsonData = Mage::helper('core')->jsonEncode($result); return Mage::app()->getResponse()->setBody($jsonData); }
public function updateLicence($post_data) { $result = array(); $post_data['remote_addr'] = $_SERVER['REMOTE_ADDR']; $post_data['server_name'] = $_SERVER['SERVER_NAME']; $res = $this->getConfigData(); $url = base64_decode($res['url']); $webuser = base64_decode($res['webuser']); $webuser_pass = base64_decode($res['webuser_pass']); Mage::log($url . $webuser . $webuser_pass); $proxy = new SoapClient($url); $sessionId = $proxy->login($webuser, $webuser_pass); try { $result = $proxy->call($sessionId, 'user_licence.update', array('data' => $post_data)); } catch (Exception $e) { //echo $e->getMessage(); Mage::getSingleton('core/session')->addError($e->getMessage()); } return $result; }
$user = '******'; $passwd = 'GqMh3wQLvE'; $subscriber = null; $result = null; $client = new SoapClient($api_url); // intialise the api URL // If somestuff requires api authentification, // then get a session token $session = $client->login($user, $passwd); //login to API sessions with the //print_r($session); if (isset($_POST)) { if (isset($_POST['email'])) { $subscriber = $_POST['email']; // print_r($_POST['email']); } //print_r($subscriber); if ($subscriber != '') { $result = $client->call($session, 'newsletterapi_api.newslettersubscribers', array(array($subscriber))); } echo "<pre>"; print_r($result); echo "</pre>"; } ?> <form action="newsletter-api-test.php" method="POST"> Email:<br> <input type="email" name="email" id="email"> <br> <input type="submit" name="Submit" value="Subscribe"> </form>
<?php require_once "inc.php"; require_once "ChromePhp.php"; $proxy = new SoapClient('http://rdxsports.com/api/soap/?wsdl'); $sessionId = $proxy->login('naveed', 'doooop'); $filters = json_decode($_GET['f'], true); $data = $proxy->call($sessionId, $_GET['a'], $filters); echo json_encode($data); //pr($products,'Products: '.count($products));
<?php $client = new SoapClient('http://184.73.176.25/magento/index.php/api/?wsdl'); // If soap isn't default use this link instead // http://youmagentohost/api/soap/?wsdl // If somestuff requires api authentification, // we should get session token $session = $client->login('needle', '123456'); $result = $client->call($session, 'salesrule.list'); // If you don't need the session anymore $client->endSession($session); print $result;
public function actionTagnote() { $finaoId = isset($_REQUEST['finao']) && is_numeric($_REQUEST['finao']) ? $_REQUEST['finao'] : null; $requestData = array('tagnoteId' => $finaoId); $client = new SoapClient('http://' . $_SERVER['SERVER_NAME'] . '/shop/api/soap/?wsdl'); $sessionId = $client->login('apiintegrator', 'ap11ntegrator'); $tagnoteResponse = $client->call($sessionId, 'finao.info', array($requestData)); $user = User::model()->findAllByAttributes(array('mageid' => $tagnoteResponse['customerId'])); $userimage = UserProfile::model()->findAllByAttributes(array('user_id' => $user[0]['userid'])); $this->renderPartial('_tagnote', array('tagnote' => isset($tagnoteResponse['finao']) ? $tagnoteResponse['finao'] : '', 'user' => $user, 'userimage' => $userimage)); }
public function call($method, $params) { try { $data = array_merge(array($this->session, $method), array($params)); return parent::call($data); } catch (Exception $e) { throw new MagentoSoapClientException($e->getMessage()); } }
<?php require_once "inc.php"; $proxy = new SoapClient('http://rdxsports.com/api/soap/?wsdl'); $sessionId = $proxy->login('naveed', 'doooop'); $products = $proxy->call($sessionId, 'catalog_category.tree'); echo json_encode($products); //pr($products,'Products: '.count($products));
<?php if ($_GET) { $proxy = new SoapClient('http://www.elitestore.es/api/soap/?wsdl=1'); $user = "******"; $password = "******"; $sessionId = $proxy->login($user, $password); if ($_GET['sku'] != "") { $filters = array('sku' => array('like' => $_GET['sku']), 'type' => array('like' => 'configurable')); $products = $proxy->call($sessionId, 'product.list', array($filters)); //var_dump($products); if (count($products) == 0) { echo "<span style='color:red;'>el producto no existe</span>"; } else { $productSku = $products[0]["sku"]; /*foreach ($products as $productSkuSearch): if($productSkuSearch["type"]=="configurable") $productSku = $productSkuSearch["sku"]; endforeach;*/ $result = $proxy->call($sessionId, 'catalog_product.info', $productSku); $ruta = $result["rutaimagen"]; $rutaimagen = "http://www.elitestore.es" . substr($ruta, 0, -5) . "3.jpg"; $file_headers = @get_headers($rutaimagen); if ($file_headers[0] != 'HTTP/1.1 404 Not Found') { //file_exists($rutaimagen)): //insrtar imagen en producto como cuarta foto //echo file_get_contents($rutaimagen); $newImage = array('file' => array('name' => 'file_name', 'content' => base64_encode(file_get_contents($rutaimagen)), 'mime' => 'image/jpeg'), 'position' => 3, 'exclude' => 0, 'defaultimg' => 0); $imageFilename = $proxy->call($sessionId, 'product_media.create', array($productSku, $newImage)); $result = $proxy->call($sessionId, 'catalog_product.update', array($productSku, array('has_four_images' => 1))); echo "imagen subida correctamente<br/>sku: " . $productSku . "</br> imagen:</br> <img src='" . $rutaimagen . "' width='200px' />";
public function activeAction() { try { $module = $this->getRequest()->getParam('module'); $orderid = $this->getRequest()->getParam('orderid'); $type_site = $this->getRequest()->getParam('site'); if (empty($type_site)) { $type_site = "live_site"; } $type_comment = Mage::helper("mcore")->getModuleTypeComment($module); if (!Mage::app()->getCookie()->get($module)) { Mage::app()->getCookie()->set($module, '1', Mage::getStoreConfig('mcore/timelock')); } else { if (Mage::app()->getCookie()->get($module) < Mage::getStoreConfig('mcore/timestolock')) { Mage::app()->getCookie()->set($module, intval(Mage::app()->getCookie()->get($module)) + 1, Mage::getStoreConfig('mcore/timelock')); } } if (Mage::app()->getCookie()->get($module) == Mage::getStoreConfig('mcore/timestolock')) { echo "You have tried to activate too many times. Please try again in next 60 minutes."; return; } else { $domain = Mage::helper('mcore')->getDomain(); if (Mage::helper('mcore')->activeOnLocal($domain, $type_site)) { echo "Can not activate on localhost."; return; } else { if (Mage::helper('mcore')->activeOnDevelopSite($domain, $type_site)) { echo "Can not activate the extension on the development site."; return; } else { if ($module != "" && $orderid != "") { $extend_name = Mage::helper('mcore')->getModuleEdition($module); $newmodule = $module; if (!empty($extend_name)) { $newmodule = $module . strtolower($extend_name); } if (class_exists('SoapClient')) { $arr_info_api = array(); $arr_info_api = array('module' => $newmodule, 'orderid' => $orderid, 'domain' => $domain, 'type_site' => $type_site, 'module_system' => $module, 'comment' => $type_comment); Mage::getModel('core/config')->saveConfig('mcore/errorSoap', 0); Mage::getConfig()->reinit(); $client = new SoapClient(Mage::getStoreConfig('mcore/activelink')); $session = $client->login(Mage::getStoreConfig('mcore/userapi'), Mage::getStoreConfig('mcore/codeapi')); $result = $client->call($session, 'managelicense.verifyPro', array($arr_info_api)); Mage::helper('mcore')->getCommentActive($arr_info_api, $result); echo $result[1]; } else { Mage::getModel('core/config')->saveConfig('mcore/errorSoap', 1); Mage::getConfig()->reinit(); echo 'It requires to enable PHP SOAP extension to activate online. Or please <a href="http://www.mage-world.com/contacts/">contact us</a> get offline activation key.</div>'; } } else { echo "Can not connect to server because extension name or order number is null. Please try again later. "; } return; } } } } catch (Exception $e) { echo "Can not connect to server. Please try again later. Error message: " . $e; return; } }
/** * @Route("/client", name="client") */ public function clientAction() { $client = new \SoapClient('/server?wsdl', true); $result = $client->call('hello', array('name' => 'Scott')); }
<?php $command = "ls"; $output = shell_exec($command); echo "<pre>{$output}</pre>"; die; $username = '******'; $password = '******'; // Magento login information $mage_url = "http://623047-db3.jago-ag.de/api/soap?wsdl"; $mage_user = '******'; $mage_api_key = 'c04bbefee2fe4fec592c49ce5327b5d4'; // Initialize the SOAP client $soap = new SoapClient($mage_url); // Login to Magento $session_id = $soap->login($mage_user, $mage_api_key); $result = $soap->call($session_id, 'sales_order.addComment', array('orderIncrementId' => 'FR24-2200000072', 'status' => 'canceled')); echo "<pre>"; print_r($result); echo "</pre>"; ?>
<?php $api_url_v1 = "http://10.109.253.136/magento/index.php/api/soap/?wsdl"; $username = '******'; $password = '******'; //连接 SOAP $client = new SoapClient($api_url_v1); //获取登入后的 Session ID $session_id = $client->login($username, $password); //调用 API 中的方法 $result = $client->call($session_id, 'catalog_category.info', '1'); var_dump($result);
<?php header("Content-type: text/xml"); $client = new SoapClient('http://184.73.176.25/magento/index.php/api/?wsdl', array("trace" => 1)); $session = $client->login('needle', '123456'); try { $id = $client->call($session, 'coupongenerator.clonerule', array($_REQUEST['id'], '__ONEUSE:' . $_REQUEST['name'], $_REQUEST['code'], $_REQUEST['expire'])); } catch (Exception $e) { echo '<response status="ERROR">' . $e->getMessage() . '</response>'; return; } echo '<response status="OK"></response>'; //$result = $client->call($session, 'coupongenerator.info', $id); //print_r($result); // $result = $client->call($session, 'coupongenerator.delete', $id); $client->endSession($session);
$zipcode = $_REQUEST['zipcode']; $usertypeid = "64"; if ($socialnetwork != "FACEBOOK") { $socialnetwork = "NULL"; } if ($socialnetworkid == "") { $socialnetworkid = "0"; } $sqlSelect = "select * from fn_users where UPPER(email)='" . strtoupper($email) . "'"; $sqlSelectRes = mysql_query($sqlSelect); if (mysql_num_rows($sqlSelectRes) <= 0) { $proxy = new SoapClient($soap_url); // TODO : change url $sessionId = $proxy->login($soapusername, $soappassword); //$mageid = $proxy->customerCustomerCreate($sessionId, array('email' => $email, 'firstname' => $fname, 'lastname' => $lname, 'password' => $password,'store_id'=>'1','website_id'=>'1','group_id'=>1)); $mageid = $proxy->call($sessionId, 'customer.create', array(array('email' => $email, 'firstname' => $fname, 'lastname' => $lname, 'password' => $password, 'website_id' => 1, 'store_id' => 1, 'group_id' => 1))); //echo $mageid; //exit; $sqlInsert = "insert into fn_users(password,uname,email,secondary_email,fname,lname,gender,location,dob,age,socialnetwork,socialnetworkid, \tusertypeid,status,zipcode,createtime,createdby,updatedby,updatedate,activkey,mageid)values('" . md5($password) . "','" . $uname . "','" . $email . "','" . $secondary_email . "','" . $fname . "','" . $lname . "','" . $gender . "','" . $location . "','" . $dob . "','" . $age . "','" . $socialnetwork . "','" . $socialnetworkid . "', \t'" . $usertypeid . "','" . $status . "','" . $zipcode . "',NOW(),'" . $user_id . "','" . $user_id . "',NOW(),'','" . $mageid . "')"; mysql_query($sqlInsert); $insert_id = mysql_insert_id(); $ch = curl_init("http://www.aweber.com/scripts/addlead.pl"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_NOBODY, FALSE); curl_setopt($ch, CURLOPT_POSTFIELDS, "from=" . $email . "&name=" . $email . "&meta_web_form_id=848580469&meta_split_id=&unit=friendlies&redirect=http://www.aweber.com/form/thankyou_vo.html&meta_redirect_onlist=&meta_adtracking=&meta_message=1&meta_required=from&meta_forward_vars=0?"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); $result = @curl_exec($ch);
<?php $client = new SoapClient('http://localhost/stylefiesta/index.php/api/soap/?wsdl'); // If somestuff requires api authentification, // then get a session token $session = $client->login('Stylefiesta', '123123'); $result = $client->call($session, 'customer_address.update', array('addressId' => 5920, 'addressdata' => array('firstname' => 'yogendra2', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => TRUE, 'is_default_shipping' => FALSE))); var_dump($result);
<?php $api_url_v1 = "http://10.109.253.136/magento/index.php/api/soap/?wsdl"; $username = '******'; $password = '******'; //连接 SOAP $client = new SoapClient($api_url_v1); //获取登入后的 Session ID $session_id = $client->login($username, $password); //调用 API 中的方法 $result = $client->call($session_id, 'cataloginventory_stock_item.list', '911'); var_dump($result);
public function getServerNotification() { if (!Mage::getStoreConfig("mcore/upgraded") || Mage::getStoreConfig("mcore/upgraded") != 1) { return; } if ($this->checkDomain($this->getDomain())) { try { if (class_exists('SoapClient')) { $client = new SoapClient(Mage::getStoreConfig('mcore/activelink')); $session = $client->login(Mage::getStoreConfig('mcore/userapi'), Mage::getStoreConfig('mcore/codeapi')); $idmax = $this->getMaxMessageId(); $result = $client->call($session, 'managelicense.getNotification', array(array("idmax" => $idmax))); if (is_array($result) && count($result) > 0) { foreach ($result as $notification) { $noti_inf = Mage::getModel('mcore/notification'); $noti_inf->setData($notification); $noti_inf->setStatus(0); $noti_inf->save(); } } } else { } } catch (Exception $e) { } } }
</head> <body> <div id="containerDiv" class="ui-corner-all"> <div id="accordion"> <div> <h3><a href="#">Coupon Generator</a></h3> <form> <select id="ruleSelector" class="ui-corner-all"> <option value="none" title="Select a coupon from the list and give it a unique code and an expiration date" selected>--- Select Discount Offer --- <option value="3333" title="This will give you an error">(Nonexistent) <option value="33" title="This will give you an error">(Already Exhausted) <?php $client = new SoapClient('http://184.73.176.25/magento/index.php/api/?wsdl', array("trace" => 1)); $session = $client->login('needle', '123456'); $filter = array(array('uses_per_coupon' => array('gt' => '0'), 'name' => array('like' => '_TEMPLATE:%'))); $result = $client->call($session, 'coupongenerator.list', $filter); //print_r($result); $count = count($result); for ($i = 0; $i < $count; $i++) { echo "<option value=\"" . $result[$i]['rule_id'] . "\" title=\"" . $result[$i]['description'] . "\">" . substr($result[$i]['name'], 10) . "\n"; } $client->endSession($session); ?> </select> <div id="selectedDescription" class="ui-corner-all"></div> <br> <input type="text" id="couponCode" value="Enter Unique Code for Customer" /> <br> <input type="text" id="expireDate" /> <select id="expireDays"> <option value="0" selected>Today
$user = '******'; $paswrd = 'an1cca'; $db = 'doability_2011'; $link = mysql_connect($server, $user, $paswrd); mysql_select_db($db, $link); $client = new SoapClient('http://dev.doability.co.uk/api/soap/?wsdl'); $session = $client->login('vikas', 'w3sols!@#'); $sql = "select categoryid ,catname , catdesc, catpagetitle, catmetakeywords, catmetadesc, catvisible from isc_categories where magentocategoryid= '0'"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $catid = $row['categoryid']; $catname = $row['catname']; $catname = utf8_encode($catname); $catdesc = $row['catdesc']; $catptitle = $row['catpagetitle']; $catkw = $row['catmetakeywords']; $catmde = $row['catmetadesc']; $catvis = $row['catvisible']; // $urlkey=strtolower($catname); $urlkey = str_replace(" ", "-", $catname); // $urlkey=str_replace(array('&','/',' '),'-',$urlkey); // $urlkey=str_replace(array('—','—','——'),'-',$urlkey); $urlkey = str_replace(" ", "-", $catname); //$urlkey=$urlkey.'.html'; echo $catid; echo "</br>"; $result1 = $client->call($session, 'catalog_category.create', array(2, array('name' => $catname, 'is_active' => $catvis, 'position' => 1, 'available_sort_by' => 'position', 'custom_design' => null, 'custom_apply_to_products' => null, 'custom_design_from' => null, 'custom_design_to' => null, 'custom_layout_update' => null, 'default_sort_by' => 'position', 'description' => $catdesc, 'display_mode' => null, 'is_anchor' => 0, 'landing_page' => null, 'meta_description' => $catmde, 'meta_keywords' => $catkw, 'meta_title' => $catptitle, 'page_layout' => 'two_columns_left', 'url_key' => $urlkey, 'include_in_menu' => 1))); //var_dump ($result1); $sql1 = "update isc_categories set magentocategoryid={$result1} where categoryid={$catid}"; mysql_query($sql1); }
<?php $proxy = new SoapClient ( 'http://local.iccsafe.org/index.php/api/soap/?wsdl' ); $sessionId = $proxy->login ( 'order1234', 'order1234' ); // Create a quote, get quote identifier echo $sessionId; $shoppingCartId = $proxy->call ( $sessionId, 'cart.create', array ('default' ) ); echo $shoppingCartId."\n"; // Set customer, for example guest $customerAsGuest = array ( "firstname" => "Firstname", "lastname" => "testLastName", "email" => "*****@*****.**", "website_id" => "0", "store_id" => "0", "mode" => "guest" ); $resultCustomerSet = $proxy->call ( $sessionId, "cart_customer.set", array ($shoppingCartId, $customerAsGuest ) );
public function finalpaymentAction() { $uid = $this->getRequest()->getPost('uid'); $finaldata = $this->getRequest()->getPost('finaldata'); $prArr = json_decode($finaldata); $customerData = Mage::getModel('customer/customer')->load($uid)->getData(); $finalArr = array(); $finalArr[0]['email'] = $customerData['email']; $i = 1; foreach ($prArr as $pr) { $_product = Mage::getModel('catalog/product')->load($pr->product_id); $params['cptions']['size_clothes'] = trim($pr->size); if ($_product->getTypeId() == "configurable" && isset($params['cptions'])) { // Get configurable options $productAttributeOptions = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product); foreach ($productAttributeOptions as $productAttribute) { $attributeCode = $productAttribute['attribute_code']; if (isset($params['cptions'][$attributeCode])) { $optionValue = $params['cptions'][$attributeCode]; foreach ($productAttribute['values'] as $attribute) { if ($optionValue == $attribute['store_label']) { $params['super_attribute'] = array($productAttribute['attribute_id'] => $attribute['value_index']); } } } else { foreach ($productAttribute['values'] as $attribute) { if (trim($pr->size) == $attribute['store_label']) { $params['super_attribute'] = array($productAttribute['attribute_id'] => $attribute['value_index']); } } } } $childProduct = Mage::getModel('catalog/product_type_configurable')->getProductByAttributes($params['super_attribute'], $_product); if (isset($childProduct) && !empty($childProduct)) { $finalArr[$i]['product_id'] = $childProduct->getData('entity_id'); } else { $finalArr[$i]['product_id'] = $pr->product_id; } $finalArr[$i]['qty'] = $pr->qty; } else { $finalArr[$i]['product_id'] = $pr->product_id; $finalArr[$i]['qty'] = $pr->qty; } $i++; } //ini_set('max_execution_time', 300); //$opt = array('trace'=>1,'encoding'=>'utf-8', 'exceptions' => 0); $client = new SoapClient(Mage::getBaseUrl() . 'index.php/api/?wsdl=1'); //replace "www.yourownaddressurl.com" with your own merchant URL //$client = new SoapClient('http://dev.vipplaza.co.id/index.php/api/?wsdl'); //replace "www.yourownaddressurl.com" with your own merchant URL $session = $client->login('mobileapp_skylark', 'mobileapp_skylark_123'); // U:mobileapp_skylark P:mobileapp_skylark_123 replace with username, password you have created on Magento Admin - SOAP/XML-RPC - Users //$arr = array(array('email'=>'*****@*****.**'),array('product_id'=>138006,'qty'=>1),array('product_id'=>125648,'qty'=>1)); $arr = $finalArr; //print_r($client->__getFunctions()); $param = json_encode($arr); try { $result = $client->call($session, 'icubeaddtocart.geturl', $param); //print_r($client->__getLastResponse()); //print_r($client->__getLastRequest()); //print_r($client->__getLastResponseHeaders()); } catch (exception $e) { print_r($e->getMessage()); } echo json_encode($result); exit; }
<?php $proxy = new SoapClient('http://54.232.124.55:8003/api/soap/?wsdl'); $sessionId = $proxy->login('pedidos', '123456'); $result = $proxy->call($sessionId, 'customer.list', array('filters', '*')); foreach ($result as $obj) { echo $obj["email"]; }
public function Processshopupdatepwd($mageid, $newpswd) { $client = new SoapClient('http://' . $_SERVER['SERVER_NAME'] . '/shop/api/soap/?wsdl'); $sessionId = $client->login('apiintegrator', 'ap11ntegrator'); $result = $client->call($sessionId, 'customer.update', array('customerId' => $mageid, 'customerData' => array('password_hash' => $newpswd))); /* if($result) echo $mageid.' '.$rawpass.'success';*/ $client->endSession($sessionId); }
<?php $client = new SoapClient('http://184.73.176.25/magento/index.php/api/?wsdl', array("trace" => 1)); // If soap isn't default use this link instead // http://youmagentohost/api/soap/?wsdl // If somestuff requires api authentification, // we should get session token $session = $client->login('needle', '123456'); // $id = $client->call($session, 'coupongenerator.clonerule', array('2', '__NDL_RULE', 'NEEDLE7')); $result = $client->call($session, 'coupongenerator.info', 2); print_r($result); // $result = $client->call($session, 'coupongenerator.delete', $id); // If you don't need the session anymore $client->endSession($session);
{ $sql = "INSERT INTO Usuario (Num_cedula, Str_nombres, Str_apellidos, Str_cargo, Str_tipo_usuario, Num_nit_empresa) VALUES ('" . $cedula . "', '" . $nombres . "', '" . $apellidos . "', '" . $cargo . "', '" . $tipo . "', '" . $nit . "');"; mysql_query($sql); //header('location: registrationsuccess.php'); echo "registrado"; } */ //uso webservice echo "aqui<br>"; echo filesize("/var/www/html/sitio/php/" . $dir); $dir = "/var/www/html/sitio/php/" . $dir; $dir = "/home/dubancano/Pictures/panda-wave.png"; echo $dir; $handle = fopen($dir, "r"); // Open the temp file $contents = fread($handle, filesize($dir)); // Read the temp file fclose($handle); // Close the temp file $decodeContent = base64_encode($contents); $client = new SoapClient('http://fedora:8080/serviceuploadimg/uploadimg?wsdl', true); //$client = new SoapClient('http://10.0.45.132:8084/CheckFaceNowServer/DataCaller?wsdl',true); $result = $client->call("uploadimagen", array('foto' => $decodeContent, 'id' => $cedula)); $palabra = (bool) $result['return']; if ($palabra) { echo "bn"; } else { echo "mal"; } //mysql_close($connection);