setConfig(array( 'mode' => 'sandbox', 'http.ConnectionTimeOut' => 30, 'log.LogEnabled' => true, 'log.FileName' => '../PayPal.log', 'log.LogLevel' => 'FINE' )); */ /** * ### getBaseUrl function * // utility function that returns base url for * // determining return/cancel urls * @return string */ function getBaseUrl() { $protocol = 'http'; if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')) { $protocol .= 's'; $protocol_port = $_SERVER['SERVER_PORT']; } else { $protocol_port = 80; } $host = $_SERVER['HTTP_HOST']; $port = $_SERVER['SERVER_PORT']; $request = $_SERVER['PHP_SELF']; return dirname($protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request); }