代码转java代码_把php代码转成java代码publicfunctionPOST($data){$this->genPostData($data);$curl=curl_init();curl_setopt($curl,CURLOPT_URL,$this->url);curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0);curl_setopt($c...
public function POST($data) {
$this->genPostData($data);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $this->url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $this->postData);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$tmpRet = curl_exec($curl);html代码转链接
if (curl_errno($curl)) {
echo '[error] CURL ERROR: ' . curl_error($curl) . PHP_EOL;
}
curl_close($curl);
$tmpArray = json_decode($tmpRet, true);
if (isset($tmpArray['header']) && isset($tmpArray['body'])) {
$this->retHead = $tmpArray['header'];
$this->retBody = $tmpArray['body'];
$this->retRaw = $tmpRet;
}
else {
echo "[error] SERVICE ERROR: {$tmpRet}" . PHP_EOL;
}
}
展开

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。