[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 curltester.php

Zen Cart 源代码 curltester.php




下载文件

文件名: curltester.php
文件类型: PHP文件
文件大小: 3.55 KiB
MD5: a10fcdc005304a3987bceb48f53f724e

curltester.php - 关闭高亮
  1. <?php
  2. /*
  3.  * @package utilities
  4.  * @copyright Copyright 2003-2010 Zen Cart Development Team
  5.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  6.  * @version $Id: curltester.php 15778 2010-04-02 02:21:17Z drbyte $
  7.  *
  8.  * This utility is simply intended to test whether the host server has the ability to use CURL to connect to external servers in order to send communications, such as for PayPal transactions
  9.  */
  10.   error_reporting(E_ALL);
  11.  
  12.   $defaultURL = "http://www.zen-cart.com/testcurl.php";
  13.   $useSSL = (isset($_GET['ssl']) && (strtolower($_GET['ssl']) == 'yes' || $_GET['ssl'] == 1)) ? true : false;
  14.   if ($useSSL) $defaultURL = "https://www.zen-cart.com/testcurl.php";
  15.   $url = $defaultURL;
  16.   $proxy = (isset($_GET['proxy'])) ? true : false;
  17.   $proxyAddress = (isset($_GET['proxyaddress'])) ? $_GET['proxyaddress'] : '';
  18.  
  19.   $testFirstData = ((isset($_GET['firstdata']) && (strtolower($_GET['firstdata']) == 'yes' || $_GET['firstdata'] == 1)) || (isset($_GET['linkpoint']) && (strtolower($_GET['linkpoint']) == 'yes' || $_GET['linkpoint'] == 1))) ? true : false;
  20.   if ($testFirstData) $url = "https://secure.linkpt.net:1129/LSGSXML";
  21.  
  22.   $testAuthnet = (isset($_GET['authnet']) && (strtolower($_GET['authnet']) == 'yes' || $_GET['authnet'] == 1)) ? true : false;
  23.   if ($testAuthnet) $url = "https://secure.authorize.net/gateway/transact.dll";
  24.  
  25.   $testPayPal = (isset($_GET['paypal']) && (strtolower($_GET['paypal']) == 'yes' || $_GET['paypal'] == 1)) ? true : false;
  26.   if ($testPayPal) $url = "https://api-3t.paypal.com/nvp";
  27.  
  28.   $_POST = array();
  29.   if (isset($GLOBALS)) unset($GLOBALS);
  30.   if (isset($_GET)) unset($_GET);
  31.   if (isset($_REQUEST)) unset($_REQUEST);
  32.   $data = "field1=This is a test&statuskey=ready";
  33.  
  34.   // Send CURL communication
  35.   $ch = curl_init();
  36.   curl_setopt($ch, CURLOPT_URL, $url);
  37.   curl_setopt($ch, CURLOPT_VERBOSE, 0);
  38.   if ($data != '') {
  39.     curl_setopt($ch, CURLOPT_POST, 1);
  40.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  41.   }
  42.   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  43.   curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
  44.   curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
  45.   curl_setopt($ch, CURLOPT_TIMEOUT, 25);
  46.   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
  47.   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); /* compatibility for SSL communications on some Windows servers (IIS 5.0+) */
  48.   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  49.   curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  50.   curl_setopt($ch, CURLOPT_USERAGENT, 'Zen Cart(tm) - CURL TEST');
  51.  
  52. /**
  53.   if ($proxy && $proxyAddress != '') {
  54.     curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, true);
  55.     @curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
  56.     curl_setopt ($ch, CURLOPT_PROXY, $proxyAddress);
  57.   }
  58. */
  59.   $result = curl_exec($ch);
  60.   $errtext = curl_error($ch);
  61.   $errnum = curl_errno($ch);
  62.   $commInfo = @curl_getinfo($ch);
  63.   curl_close ($ch);
  64.  
  65. // enclose URL in quotes so it doesn't get converted to a clickable link if posted on the forum
  66.   if (isset($commInfo['url'])) $commInfo['url'] = '"' . $commInfo['url'] . '"';
  67.  
  68. // Handle results
  69.   echo ($errnum != 0 ? '<br />' . $errnum . ' ' . $errtext . '<br />' : '');
  70.   if ($url == $defaultURL) {
  71.     echo $result;
  72.   } else {
  73.     if ($commInfo['http_code'] == 200) echo 'COMMUNICATIONS TEST OKAY.<br />You may see error information below, but that information simply confirms that the server actually responded, which means communications is open.';
  74.   }
  75.   echo '<pre>' . print_r($commInfo, true) . '</pre><br /><br />';
  76.   if ($url != $defaultURL) echo $result . '<br>EOF';
  77.  
  78.  


cron