[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.59 KiB
MD5: bf518e064f646ee932e8c0829a4b5eb2

curltester.php - 关闭高亮
  1. <?php
  2. /*
  3.  * @package utilities
  4.  * @copyright Copyright 2003-2011 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 18695 2011-05-04 05:24:19Z 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_SSLVERSION, 3);
  51.   curl_setopt($ch, CURLOPT_USERAGENT, 'Zen Cart(tm) - CURL TEST');
  52.  
  53. /**
  54.   if ($proxy && $proxyAddress != '') {
  55.     curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, true);
  56.     @curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
  57.     curl_setopt ($ch, CURLOPT_PROXY, $proxyAddress);
  58.   }
  59. */
  60.   $result = curl_exec($ch);
  61.   $errtext = curl_error($ch);
  62.   $errnum = curl_errno($ch);
  63.   $commInfo = @curl_getinfo($ch);
  64.   curl_close ($ch);
  65.  
  66. // enclose URL in quotes so it doesn't get converted to a clickable link if posted on the forum
  67.   if (isset($commInfo['url'])) $commInfo['url'] = '"' . $commInfo['url'] . '"';
  68.  
  69. // Handle results
  70.   echo ($errnum != 0 ? '<br />' . $errnum . ' ' . $errtext . '<br />' : '');
  71.   if ($url == $defaultURL) {
  72.     echo $result;
  73.   } else {
  74.     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.';
  75.   }
  76.   echo '<pre>' . print_r($commInfo, true) . '</pre><br /><br />';
  77.   if ($url != $defaultURL) echo $result . '<br>EOF';
  78.  
  79.  


cron