Exemplo n.º 1
0
function test($appID)
{
    $execute = curlExec(STEAMAPI . ISTEAMNEWS . "GetNewsForApp/v0002" . "?appid=" . $appID . "&format=json", null, 'GET');
    if ($execute['status'] == 200) {
        print_r($execute['output']);
    }
}
/**
* @author Ashish Solanki
*/
function requestMerchant($param)
{
    $_url = '';
    $_bankId = "1234";
    $datenow = date("d/m/Y h:m:s");
    $encodedDate = str_replace(" ", "%20", $datenow);
    $_url = $_url . $param['paynetz_url'];
    $postFields = "";
    $postFields .= "&login="******"&pass="******"&ttype=" . $param['ttype'];
    $postFields .= "&prodid=" . $param['prod_id'];
    $postFields .= "&amt=" . $param['amount'];
    $postFields .= "&txncurr=" . $param['curr'];
    $postFields .= "&txnscamt=" . $param['txnamt'];
    $postFields .= "&clientcode=" . urlencode(base64_encode($param['client_code']));
    $postFields .= "&txnid=" . $param['ordernum'];
    $postFields .= "&date=" . $encodedDate;
    $postFields .= "&custacc=" . $param['customer_acc_no'];
    //Uncomment below line for broker
    $postFields .= "&bankid=" . $_bankId;
    $sendUrl = $_url . "?" . substr($postFields, 1) . "\n";
    $returnData = curlExec($sendUrl);
    $xmlObjArray = xmltoarray($returnData);
    $url = $xmlObjArray['url'];
    $postFields = "";
    $postFields .= "&ttype=" . $param['ttype'];
    $postFields .= "&tempTxnId=" . $xmlObjArray['tempTxnId'];
    $postFields .= "&token=" . $xmlObjArray['token'];
    $postFields .= "&txnStage=1";
    $url = $_url . "?" . $postFields;
    header("Location: " . $url);
}
 protected function _browseToHomePage()
 {
     $ch = curlInit();
     curlSetopt($ch, CURLOPT_URL, SHIPPING_FEDEX_HOME_SERVER);
     curlSetopt($ch, CURLOPT_USERAGENT, SHIPPING_FEDEX_SERVER_USERAGENT);
     curlSetopt($ch, CURLOPT_FAILONERROR, 1);
     curlSetopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curlSetopt($ch, CURLOPT_TIMEOUT, SHIPPING_FEDEX_SERVER_TIMEOUT);
     curlSetopt($ch, CURLOPT_COOKIEJAR, SHIPPING_FEDEX_SERVER_COOKIE_FILE);
     curlSetopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curlExec($ch);
     if (curlErrno($ch) != 0) {
         Debug::writeError('curl error', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('error' => curlError($ch)));
         curlClose($ch);
         return false;
     }
     curlClose($ch);
     return true;
 }
Exemplo n.º 4
0
/**
 * @param array $dependency
 * @param array $installDir	directory where the dependency must be copied to
 * @param array $processed contains list of directories already scanned for dependency
 */
function customInstall($dependency, $installDir, &$processed)
{
    if (isset($dependency['autoload']['psr-0'])) {
        echo "error: The SDK you are trying to install or one of its dependeincies is namespace based. enter the specific version in composer.json to install non-namespace based SDK. Else download the latest SDK from github for namespace based SDK";
        exit;
    }
    $tagUrl = sprintf('https://api.github.com/repos/%s/%s/git/refs/tags/', $dependency['group'], $dependency['artifact']);
    $branchUrl = sprintf('https://api.github.com/repos/%s/%s/git/refs/heads/', $dependency['group'], $dependency['artifact']);
    $branchArray = extractRef($branchUrl);
    $tagsArray = extractRef($tagUrl);
    $dependency['branch'] = getTag($dependency['branch'], $tagsArray, $branchArray);
    // download zip from github
    $downloadUrl = sprintf('https://api.github.com/repos/%s/%s/zipball/%s', $dependency['group'], $dependency['artifact'], $dependency['branch']);
    if (!in_array($downloadUrl, $processed)) {
        echo "Downloading " . $dependency['artifact'] . ' - ' . $dependency['branch'] . PHP_EOL;
        $dest = 'vendor/' . $installDir . '/';
        $fileZip = tempnam(sys_get_temp_dir(), 'ppzip');
        $fp = fopen($fileZip, "w");
        curlExec($downloadUrl, $fp);
        $processed[] = $downloadUrl;
        // extract the downloaded zip
        $zip = new ZipArchive();
        if ($zip->open($fileZip) != "true") {
            echo PHP_EOL . "Could not open {$fileZip}";
            exit;
        }
        $zip->extractTo($dest);
        $zip->close();
        fclose($fp);
        unlink($fileZip);
        // scan extracted directory for nested dependency
        foreach (glob("{$dest}/**/composer.json") as $composer) {
            $json = file_get_contents($composer);
            $json_a = json_decode($json, true);
            $dependencies = getDependency($json_a);
            foreach ($dependencies as $dependency) {
                customInstall($dependency, $dependency['group'], $processed);
            }
        }
    }
}
$url = Tools::safeOutput(Configuration::get('PAYNETZ_API_MERCHANT_URL'));
$postFields = "";
$postFields .= "&login="******"&pass="******"&ttype=NBFundTransfer";
$postFields .= "&prodid=" . Tools::safeOutput(Configuration::get('PAYNETZ_API_PRODUCT_ID'));
$postFields .= "&amt=" . number_format((double) $cart->getOrderTotal(true, 3), 2, '.', '');
$postFields .= "&txncurr=INR";
$postFields .= "&txnscamt=0";
$postFields .= "&clientcode=" . urlencode(base64_encode("007"));
$postFields .= "&txnid=" . $_POST['x_invoice_num'];
$postFields .= "&date=" . $encodedDate;
$postFields .= "&custacc=1234567890";
$postFields .= "&ru=" . $returnUrl;
$sendUrl = $url . "?" . substr($postFields, 1) . "\n";
$returnData = curlExec($sendUrl);
$xmlObjArray = xmltoarray($returnData);
$url = $xmlObjArray['url'];
$postFields = "";
$postFields .= "&ttype=NBFundTransfer";
$postFields .= "&tempTxnId=" . $xmlObjArray['tempTxnId'];
$postFields .= "&token=" . $xmlObjArray['token'];
$postFields .= "&txnStage=1";
$url = $url . "?" . $postFields;
header("Location: " . $url);
function xmltoarray($data)
{
    $parser = xml_parser_create('');
    xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
Exemplo n.º 6
0
/**
 * @param array $json_a content of composer.json
 * @param array $skipDir contains list of directories already scanned for dependency
 */
function customInstall($downloadUrl, $installDir, $skipDir)
{
    /**
     *  download zip from github
     */
    $fileZip = "tempZip.zip";
    $dest = 'vendor/' . $installDir . '/';
    $tempSourceDir = 'sdk-core-php-composer';
    $fp = fopen("{$fileZip}", "w");
    curlExec($downloadUrl, $fp);
    $zip = new ZipArchive();
    if ($zip->open($fileZip) != "true") {
        echo PHP_EOL . "Could not open {$fileZip}";
        exit;
    }
    /**
     * extract the downloaded zip
     **/
    $zip->extractTo($dest);
    $zip->close();
    fclose($fp);
    unlink($fileZip);
    /**
     * scan extracted directory for nested dependency
     */
    $results = scandir($dest);
    foreach ($results as $result) {
        if ($result === '.' or $result === '..') {
            continue;
        }
        if (is_dir($dest . '/' . $result)) {
            /**
             *  skip the directories already scanned
             */
            if (!in_array($result, $skipDir)) {
                $scannedFiles = scandir($dest . '/' . $result);
                foreach ($scannedFiles as $file) {
                    /**
                     * copy the config file to root directory
                     */
                    if ($file == 'config') {
                        if (!is_dir("config")) {
                            mkdir("config");
                        }
                        copyConfig($dest . '/' . $result . '/' . $file . '/', 'config/');
                        rmdir($dest . '/' . $result . '/' . $file);
                    }
                    if ($file == COMPOSER_FILE) {
                        $json = file_get_contents($dest . '/' . $result . '/' . COMPOSER_FILE);
                        $json_a = json_decode($json, true);
                        $skipDir[] = $result;
                        $dependencies = getDependency($json_a);
                        if (!empty($dependencies)) {
                            foreach ($dependencies as $dependency) {
                                $downloadUrl = 'https://api.github.com/repos/' . $dependency['group'] . '/' . $dependency['artifact'] . '/zipball/' . $dependency['branch'];
                                echo "downloading dependency " . $dependency['artifact'] . '...' . PHP_EOL;
                                customInstall($downloadUrl, $dependency['group'], $skipDir);
                            }
                        }
                    }
                }
            }
        }
    }
}