PHP GET and POST data with fsockopen?

– Digital Human Nov 9 '10 at 15:53 it flushes any buffered data through the stream. – jay. Lee Nov 9 '10 at 15:57.

You're doing a GET and a POST in the same connection, This isn't valid for HTTP/1.0 which you have specified and re-assured via connection: close. Comment out your get portion and just do the post. You can get data back with a post, so you don't need to do a get and a post.

Or if you do need to do a get and a post, close the socket, then re-establish the socket again for the post.

I need to firts do the get to get the $view_state value, otherwise it would be empty. When I re-astablish a new connection the $view_state would be different, so that wouldn't help. – Digital Human Nov 9 '10 at 15:51 Then after the GET, close the socket, and open another connection for the POST.

The connection should be getting dropped after your get buffer empties, and your post is ignored. – superfro Nov 9 '10 at 15:54 Whoops, re-read your statment. Well, if you must have the same connection you need to switch to http 1.1, and use persistent connections via Connection: Keep-Alive instead of connection: close – superfro Nov 9 '10 at 16:01 Ok, then I get do the get request firts, flush using fflush, and then do the post?

– Digital Human Nov 9 '10 at 17:01.

Curl is too heavy in some case, to use post_to_host(): //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($GLOBALSmt_rand()=tmpfile()))); $arr_params=array('para1'=>'...', 'para2'=>'...'); file_put_contents($tmp, json_encode($arr_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'); post to host php project location: code.google.com/p/post-to-host.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send