<?php
define (
'IS_PROXY'
, true );
$cookie_file
= dirname (
__FILE__
) .
"/cookie_"
. md5 (
basename
(
__FILE__
) ) .
".txt"
;
$user_agent
=
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)"
;
function
vlogin(
$url
,
$data
) {
$curl
= curl_init ();
if
(IS_PROXY) {
curl_setopt (
$curl
, CURLOPT_PROXY,
$GLOBALS
[
'proxy'
] );
}
curl_setopt (
$curl
, CURLOPT_URL,
$url
);
curl_setopt (
$curl
, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt (
$curl
, CURLOPT_SSL_VERIFYHOST, 1 );
curl_setopt (
$curl
, CURLOPT_USERAGENT,
$GLOBALS
[
'user_agent'
] );
@curl_setopt (
$curl
, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt (
$curl
, CURLOPT_AUTOREFERER, 1 );
curl_setopt (
$curl
, CURLOPT_POST, 1 );
curl_setopt (
$curl
, CURLOPT_POSTFIELDS,
$data
);
curl_setopt (
$curl
, CURLOPT_COOKIEJAR,
$GLOBALS
[
'cookie_file'
] );
curl_setopt (
$curl
, CURLOPT_COOKIEFILE,
$GLOBALS
[
'cookie_file'
] );
curl_setopt (
$curl
, CURLOPT_TIMEOUT, 30 );
curl_setopt (
$curl
, CURLOPT_HEADER, 0 );
curl_setopt (
$curl
, CURLOPT_RETURNTRANSFER, 1 );
$tmpInfo
= curl_exec (
$curl
);
if
(curl_errno (
$curl
)) {
echo
'Errno'
. curl_error (
$curl
);
}
curl_close (
$curl
);
return
$tmpInfo
;
}
function
vget(
$url
) {
$curl
= curl_init ();
if
(IS_PROXY) {
curl_setopt (
$curl
, CURLOPT_PROXY,
$GLOBALS
[
'proxy'
] );
}
curl_setopt (
$curl
, CURLOPT_URL,
$url
);
curl_setopt (
$curl
, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt (
$curl
, CURLOPT_SSL_VERIFYHOST, 1 );
curl_setopt (
$curl
, CURLOPT_USERAGENT,
$GLOBALS
[
'user_agent'
] );
@curl_setopt (
$curl
, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt (
$curl
, CURLOPT_AUTOREFERER, 1 );
curl_setopt (
$curl
, CURLOPT_HTTPGET, 1 );
curl_setopt (
$curl
, CURLOPT_COOKIEFILE,
$GLOBALS
[
'cookie_file'
] );
curl_setopt (
$curl
, CURLOPT_TIMEOUT, 120 );
curl_setopt (
$curl
, CURLOPT_HEADER, 0 );
curl_setopt (
$curl
, CURLOPT_RETURNTRANSFER, 1 );
$tmpInfo
= curl_exec (
$curl
);
if
(curl_errno (
$curl
)) {
echo
'Errno'
. curl_error (
$curl
);
}
curl_close (
$curl
);
return
$tmpInfo
;
}
function
vpost(
$url
,
$data
) {
$curl
= curl_init ();
if
(IS_PROXY) {
curl_setopt (
$curl
, CURLOPT_PROXY,
$GLOBALS
[
'proxy'
] );
}
curl_setopt (
$curl
, CURLOPT_URL,
$url
);
curl_setopt (
$curl
, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt (
$curl
, CURLOPT_SSL_VERIFYHOST, 1 );
curl_setopt (
$curl
, CURLOPT_USERAGENT,
$GLOBALS
[
'user_agent'
] );
@curl_setopt (
$curl
, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt (
$curl
, CURLOPT_AUTOREFERER, 1 );
curl_setopt (
$curl
, CURLOPT_POST, 1 );
curl_setopt (
$curl
, CURLOPT_POSTFIELDS,
$data
);
curl_setopt (
$curl
, CURLOPT_COOKIEFILE,
$GLOBALS
[
'cookie_file'
] );
curl_setopt (
$curl
, CURLOPT_TIMEOUT, 120 );
curl_setopt (
$curl
, CURLOPT_HEADER, 0 );
curl_setopt (
$curl
, CURLOPT_RETURNTRANSFER, 1 );
$tmpInfo
= curl_exec (
$curl
);
if
(curl_errno (
$curl
)) {
echo
'Errno'
. curl_error (
$curl
);
}
curl_close (
$curl
);
return
$tmpInfo
;
}
function
delcookie(
$cookie_file
) {
unlink (
$cookie_file
);
}
?>