1024programmer Java How to convert php-PHP to Java, please help me

How to convert php-PHP to Java, please help me

php

protected function _postWithCOOKIE($uri, $data){ $fp = fsockopen('f.10086.cn', 80); fputs($fp, "POST $uri  HTTP/1.1\r\n"); fputs($fp, "Host: f.10086.cn\r\n"); fputs($fp, "COOKIE: {$this->_COOKIE}\r\n"  ); fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n"); fputs($fp, "User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0)  Gecko/20100101 Firefox/14.0.1\r\n"); fputs($fp, "Content-Length: ".strlen($data)."\r\n"); fputs($fp, "Connection: close  \r\n\r\n"); fputs($fp, $data); $result = ''; while (!feof($fp)) { $result .= fgets($fp); } fclose($  fp); return $result;}

How to implement this code in Java

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-to-convert-php-php-to-java-please-help-me-3/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索