Пример #1
0
function post()
{
    list($method, $url, $headers, $kwargs, $body) = @decode_request(@file_get_contents('php://input'));
    $password = $GLOBALS['__password__'];
    if ($password) {
        if (!isset($kwargs['password']) || $password != $kwargs['password']) {
            header("HTTP/1.0 403 Forbidden");
            echo message_html('403 Forbidden', 'Wrong Password', "please edit proxy.ini");
            exit(-1);
        }
    }
    $hostsdeny = $GLOBALS['__hostsdeny__'];
    if ($hostsdeny) {
        $urlparts = parse_url($url);
        $host = $urlparts['host'];
        foreach ($hostsdeny as $pattern) {
            if (substr($host, strlen($host) - strlen($pattern)) == $pattern) {
                echo_content("HTTP/1.0 403\r\n\r\n" . message_html('403 Forbidden', "hostsdeny matched({$host})", $url));
                exit(-1);
            }
        }
    }
    if ($body) {
        $headers['Content-Length'] = strval(strlen($body));
    }
    if (isset($headers['Connection'])) {
        $headers['Connection'] = 'close';
    }
    $header_array = array();
    foreach ($headers as $key => $value) {
        $header_array[] = join('-', array_map('ucfirst', explode('-', $key))) . ': ' . $value;
    }
    $timeout = $GLOBALS['__timeout__'];
    $curl_opt = array();
    switch (strtoupper($method)) {
        case 'HEAD':
            $curl_opt[CURLOPT_NOBODY] = true;
            break;
        case 'GET':
            break;
        case 'POST':
            $curl_opt[CURLOPT_POST] = true;
            $curl_opt[CURLOPT_POSTFIELDS] = $body;
            break;
        case 'PUT':
        case 'DELETE':
            $curl_opt[CURLOPT_CUSTOMREQUEST] = $method;
            $curl_opt[CURLOPT_POSTFIELDS] = $body;
            break;
        default:
            echo_content("HTTP/1.0 502\r\n\r\n" . message_html('502 Urlfetch Error', 'Invalid Method: ' . $method, $url));
            exit(-1);
    }
    $curl_opt[CURLOPT_HTTPHEADER] = $header_array;
    $curl_opt[CURLOPT_RETURNTRANSFER] = true;
    $curl_opt[CURLOPT_BINARYTRANSFER] = true;
    $curl_opt[CURLOPT_HEADER] = false;
    $curl_opt[CURLOPT_HEADERFUNCTION] = 'curl_header_function';
    $curl_opt[CURLOPT_WRITEFUNCTION] = 'curl_write_function';
    $curl_opt[CURLOPT_FAILONERROR] = false;
    $curl_opt[CURLOPT_FOLLOWLOCATION] = false;
    $curl_opt[CURLOPT_CONNECTTIMEOUT] = $timeout;
    $curl_opt[CURLOPT_TIMEOUT] = $timeout;
    $curl_opt[CURLOPT_SSL_VERIFYPEER] = false;
    $curl_opt[CURLOPT_SSL_VERIFYHOST] = false;
    $ch = curl_init($url);
    curl_setopt_array($ch, $curl_opt);
    $ret = curl_exec($ch);
    $errno = curl_errno($ch);
    if ($GLOBALS['__content__']) {
        echo_content($GLOBALS['__content__']);
    } else {
        if ($errno) {
            if (!headers_sent()) {
                header('Content-Type: ' . $__content_type__);
            }
            $content = "HTTP/1.0 502\r\n\r\n" . message_html('502 Urlfetch Error', "PHP Urlfetch Error curl({$errno})", curl_error($ch));
            echo_content($content);
        }
    }
    curl_close($ch);
}
Пример #2
0
        $sym = '€';
        break;
}
?>
<!-- Site Description -->
<div class="presentation container">
	<h2><?php 
echo $data->main_headline != '' ? stripslashes($data->main_headline) : 'We are <span class="violet">SocialPiggy</span>, a viral marketing company.';
?>
</h2>
	<p><?php 
echo $data->main_headline != '' ? stripslashes($data->sub_headline) : 'We create viral buzz around the internet...';
?>
</p>
	<div class="message-box-container clearfix text-left"><?php 
echo message_html();
?>
</div>
</div>
<div class="well clearfix text-right">
	<a href="<?php 
echo SITE_URL . 'outsourcelisting.php';
?>
">My Outsourced Jobs</a>
</div>
<?php 
$fixed_str = '	<input type="hidden" name="cmd" value="_xclick">
					<input type="hidden" name="business" value="' . $settings->paypal . '">
					<input type="hidden" name="lc" value="US">
					<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest" />';
$btn = '<input type="submit" class="btn_new" value="Order Now" />';