Home
Name Modified Size InfoDownloads / Week
post_to_host.v.kd68.php 2013-06-08 15.7 kB
post_to_host.v.kcc4.php 2012-12-04 11.7 kB
post_to_host.v.kc6t.php 2012-06-29 11.6 kB
readme.txt 2012-06-28 2.9 kB
post_to_host.v.kc6c.php 2012-06-11 10.2 kB
post_to_host.v.kc3v.php 2012-03-30 9.3 kB
post_to_host.v.kc34.php 2012-03-05 8.9 kB
post_to_host.v.kc26.php 2012-02-06 8.7 kB
post_to_host.v.kc1b.php 2012-01-11 8.1 kB
post_to_host.v.kbcu.php 2011-12-30 7.6 kB
post_to_host.v.kbc8.php 2011-12-08 7.3 kB
post_to_host.kbb8.php 2011-11-09 5.6 kB
Totals: 12 Items   107.7 kB 0
post_to_host.php to replace curl with fsockopen:

variable prefix explanation:

    'arr' means any array, such as: array('var1'=>'val1', 'var2'=>'val2'), or empty one: array()
    'ref_arr' means any array returned after post_to_host executed, you don't need define it in advance, print it:var_export($ref_arr_head)
    'str' means any string, such as: 'http://www.google.com', or empty one: '' 

//GET:
$str_rtn=post_to_host($str_url_target, array(), $arr_cookie, $str_url_referer, $ref_arr_head, 0);

//POST:
$arr_params=array('para1'=>'...', 'para2'=>'...');
$str_rtn=post_to_host($str_url_target, $arr_params, $arr_cookie, $str_url_referer, $ref_arr_head);

//POST with file:
$arr_params=array('para1'=>'...', 'FILE:para2'=>'/tmp/test.jpg', 'para3'=>'...');
$str_rtn=post_to_host($str_url_target, $arr_params, $arr_cookie, $str_url_referer, $ref_arr_head, 2);

//raw POST with file:
$str_rtn=post_to_host($str_url_target, array('/tmp/test.jpg'), $arr_cookie, $str_url_referer, $ref_arr_head, 3);

//get cookie and merge cookies:
$arr_new_cookie=get_cookies_from_heads($ref_arr_head)+$arr_old_cookie;//don't change the order

//get redirect url:
$str_url_redirect=get_from_heads($ref_arr_head, 'Location');

//POST with custom headers:
$arr_params=array('para1'=>'...', 'para2'=>'...', 'HEADER:username'=>'peter', 'HEADER:password'=>'google');
$str_rtn=post_to_host($str_url_target, $arr_params, $arr_cookie, $str_url_referer, $ref_arr_head);

//raw POST with custom headers:
$str_file_name=array_search('uri', @array_flip(stream_get_meta_data($GLOBALS[mt_rand()]=tmpfile())));
$arr_params=array('para1'=>'...', 'para2'=>'...');
file_put_contents($str_file_name, json_encode($arr_params));
$arr_params=array($str_file_name, 'HEADER:Content-Type'=>'application/json');
$str_rtn=post_to_host($str_url_target, $arr_params, $arr_cookie, $str_url_referer, $ref_arr_head, 3);

//POST with specified IP:
$GLOBALS['POST_TO_HOST.HOSTS']['www.domain1.com']=gethostbyname('www.domain1.com');//or '11.12.13.14'
post_to_host('http://www.domain1.com/login.php', $arr_params, $arr_cookie, $str_url_referer, $ref_arr_head);

//POST with specified HTTP proxy domain or HTTP proxy IP:
$GLOBALS['POST_TO_HOST.HOSTS']['www.domain1.com']='www.proxy1.com:8080';//or '11.12.13.14:8080'
post_to_host('http://www.domain1.com/login.php', $arr_params, $arr_cookie, $str_url_referer, $ref_arr_head);

//POST with specified SOCKS5 proxy domain or SOCKS5 proxy IP:
$GLOBALS['POST_TO_HOST.HOSTS']['www.domain1.com']='www.proxy1.com:8080:SOCKS5';//or '11.12.13.14:8080:SOCKS5'
post_to_host('http://www.domain1.com/login.php', $arr_params, $arr_cookie, $str_url_referer, $ref_arr_head);

//set total timeout(default total timeout is 60):
$GLOBALS['POST_TO_HOST.TOTAL_TIMEOUT']=20;

//set connection timeout and line read/write timeout(default is 5):
$GLOBALS['POST_TO_HOST.LINE_TIMEOUT']=10;
Source: readme.txt, updated 2012-06-28