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/Http.php.sample
<?php

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

namespace Xtento\StockImport\Model\Source;

class Http 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 = [];
        // Do whatever - sample code for a HTTP request below.
        $curlClient = curl_init();
        curl_setopt($curlClient, CURLOPT_URL, '');
        curl_setopt($curlClient, CURLOPT_RETURNTRANSFER, 1);
        /*curl_setopt($curlClient, CURLOPT_POST, 1);
        curl_setopt($curlClient, CURLOPT_POSTFIELDS, []);*/
        curl_setopt($curlClient, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($curlClient, CURLOPT_SSL_VERIFYHOST, 0);
        $fileContents = curl_exec($curlClient);
        curl_close($curlClient);

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

        // Return files to process
        return $filesToProcess;
    }

    /* Another sample function */
    /*
    public function sampleFunctionName()
    {
        $filesToProcess = [];
        $filesToProcess[] = ['source_id' => $this->getSource()->getId(), 'path' => '', 'filename' => 'michael_kors.csv', 'data' => file_get_contents('http://www.url.to/csv.file')];
        return $filesToProcess;
    }
    */

     /*
      * !!!!! Do not modify below this line !!!!!
      */
     public function testConnection()
     {
         $this->initConnection();
         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__));
         }
         $this->getSource()->setLastResult($this->getTestResult()->getSuccess())->setLastResultMessage($this->getTestResult()->getMessage())->save();
         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