note 107029 deleted from function.curl-setopt by danbrown

From: Date: Tue, 03 Jan 2012 21:49:28 +0000
Subject: note 107029 deleted from function.curl-setopt by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-185293@lists.php.net to get a copy of this message
Note Submitter: kexianbin at diyism dot com ---- CURL is too heavy in some case, to use post_to_host(): <?php //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: $tmp=array_search('uri', @array_flip(stream_get_meta_data($GLOBALS[mt_rand()]=tmpfile()))); $arr_params=array('para1'=>'...', 'para2'=>'...'); file_put_contents($tmp, json_encode($params)); $arr_params=array($tmp); $str_rtn=post_to_host($str_url_target, $arr_params, $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'); ?> Project location: http://code.google.com/p/post-to-host/

« previous php.notes (#185293) next »