$value) { $url .= $key . '=' . urlencode($value) . '&'; } sendHeader("Content-Type: image/gif"); $stream_options = array('http' => array( 'user_agent' => arrayValue($_SERVER, 'HTTP_USER_AGENT', ''), 'header' => sprintf("Accept-Language: %s\r\n", str_replace(array("\n", "\t", "\r"), "", arrayValue($_SERVER, 'HTTP_ACCEPT_LANGUAGE', ''))), 'timeout' => $timeout )); $ctx = stream_context_create($stream_options); echo file_get_contents($url, 0, $ctx); function getVisitIp() { $matchIp = '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/'; $ipKeys = array( 'HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_CF_CONNECTING_IP', ); foreach($ipKeys as $ipKey) { if (isset($_SERVER[$ipKey]) && preg_match($matchIp, $_SERVER[$ipKey])) { return $_SERVER[$ipKey]; } } return arrayValue($_SERVER, 'REMOTE_ADDR'); }