_cookie}rn"); fputs($fp, "/> _cookie}rn"); fputs($fp, ">
Home > Backend Development > PHP Tutorial > php-PHP转Java该怎么实现,请大神帮忙

php-PHP转Java该怎么实现,请大神帮忙

WBOY
Release: 2016-06-02 11:33:25
Original
867 people have browsed it

php

<code>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;}</code>
Copy after login

这段代码用Java怎么实现

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template