Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/cartforge.co/app/code/Xtento/StockImport/Model/Source/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/app/code/Xtento/StockImport/Model/Source/Webservice.php.sample
<?php

/**
 * Product:       Xtento_StockImport
 * ID:            u66QkJ5rBwmimhUzUElhIKqqWRvsbhC3WLqSMk5AjmQ=
 * Last Modified: 2019-02-05T17:10:52+00:00
 * File:          app/code/Xtento/StockImport/Model/Source/Webservice.php.sample
 * Copyright:     Copyright (c) XTENTO GmbH & Co. KG <[email protected]> / All rights reserved.
 */

namespace Xtento\StockImport\Model\Source;

class Webservice extends AbstractClass
{
    /*
     * !!!!! IMPORTANT !!!!!
     *
     * Modify below this line. Add custom functions, similar to the function below. Must return parameter $filesToProcess as in example below.
     */
    public function yourFunctionName()
    {
        $filesToProcess = [];
        $fileContents = "";

        // Do whatever - sample code for a API request below, must be modified so that $fileContents contains the contents (CSV/XML/...) to import.
        /*$client = new SoapClient("http://www.api.com/request.php?wsdl"); // Alternatively use another SOAP client
        try {
            $result = $client->getStockLevel(array('user' => 'abc'));
        } catch (SoapFault $e) {
            #echo $e->getMessage(); die();
        }
        if ($fileContents && !empty($fileContents)) {

        }*/

        // Set a filename here. 'data' must contain the returned string from the HTTP source which will then be imported
        $filesToProcess[] = ['source_id' => $this->getSource()->getId(), 'path' => '', 'filename' => 'http_download', 'data' => $fileContents];

        // Return files to process
        return $filesToProcess;
    }

    /*
     * !!!!! Do not modify below this line !!!!!
     */
    public function testConnection()
    {
        $this->initConnection();
        if (!$this->getSource()->getBackupSource()) {
            $this->getSource()->setLastResult($this->getTestResult()->getSuccess())->setLastResultMessage($this->getTestResult()->getMessage())->save();
        }
        return $this->getTestResult();
    }

    public function initConnection()
    {
        $this->setSource($this->sourceFactory->create()->load($this->getSource()->getId()));
        $testResult = new \Magento\Framework\DataObject();
        $this->setTestResult($testResult);
        if (!@method_exists($this, $this->getSource()->getCustomFunction())) {
            $this->getTestResult()->setSuccess(false)->setMessage(__('Custom function/method \'%1\' not found in %2.', $this->getSource()->getCustomFunction(), __FILE__));
        } else {
            $this->getTestResult()->setSuccess(true)->setMessage(__('Custom function/method found and ready to use.', __FILE__));
        }
        return true;
    }

    public function loadFiles()
    {
        // Init connection
        $this->initConnection();
        // Call custom function
        $filesToProcess = @$this->{$this->getSource()->getCustomFunction()}();
        return $filesToProcess;
    }

    public function archiveFiles($filesToProcess, $forceDelete = false)
    {

    }
}

Spamworldpro Mini