php error_reporting E_ALL E_STRICT ini_set display_errors include Snoo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
error_reporting(E_ALL ^ E_STRICT);
ini_set('display_errors', 1);
include "Snoopy.class.php";
$snoopy = new Snoopy();
$GATE_URL = 'http://localhost:8000';
$QUERY_ARGS = array(
//'url' => sprintf('http://%s', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']),
//'ua' => $_SERVER['HTTP_USER_AGENT'],
);
$QUERY_STRING = '?';
foreach($QUERY_ARGS as $key => $value) {
if ($QUERY_STRING != '?') {
$QUERY_STRING .= '&';
}
$QUERY_STRING .= $key . '=' . urlencode($value);
}
//$data = http_get($GATE_URL . $QUERY_STRING);
//$snoopy->fetch($GATE_URL . $QUERY_STRING);
//
$request_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$snoopy->host = 'localhost';
$snoopy->port = 8000;
$snoopy->rawheaders = array('Host' => $_SERVER['HTTP_HOST']);
$snoopy->_connect($fp);
$snoopy->_httprequest($_SERVER['REQUEST_URI'], $fp, $_SERVER['REQUEST_URI'], 'GET');
$snoopy->_disconnect($fp);
echo $snoopy->results;
?>