php代码转换为java 10
$b='https://www.sandlife.com.cn/Oauth/user';$post='access_token='.$res['access_token'...
$b='https://www.sandlife.com.cn/Oauth/user';
$post='access_token='.$res['access_token'];
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$b);
curl_setopt($curl, CURLOPT_PORT, 443);
curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //信任任何证书
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 检查证书中是否设置域名,0不验证
curl_setopt($curl, CURLOPT_VERBOSE, 1); //debug模式
curl_setopt($curl, CURLOPT_SSLCERT, "E:\\htdocs\\xxxxxx.crt"); //client.crt文件路径
curl_setopt($curl, CURLOPT_SSLCERTPASSWD, "sand123"); //client证书密码
curl_setopt($curl, CURLOPT_SSLKEY, "E:\\htdocs\\xxxxx.key"); //key文件路径
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
$ret = curl_exec($curl);
curl_close($curl);
请帮忙下 展开
$post='access_token='.$res['access_token'];
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$b);
curl_setopt($curl, CURLOPT_PORT, 443);
curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //信任任何证书
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 检查证书中是否设置域名,0不验证
curl_setopt($curl, CURLOPT_VERBOSE, 1); //debug模式
curl_setopt($curl, CURLOPT_SSLCERT, "E:\\htdocs\\xxxxxx.crt"); //client.crt文件路径
curl_setopt($curl, CURLOPT_SSLCERTPASSWD, "sand123"); //client证书密码
curl_setopt($curl, CURLOPT_SSLKEY, "E:\\htdocs\\xxxxx.key"); //key文件路径
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
$ret = curl_exec($curl);
curl_close($curl);
请帮忙下 展开
展开全部
这就是一个curl 网络请求额,https的post请求,改造下就行
追问
我弄了很久不太好弄啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-10-12
展开全部
请看 HttpsURLConnection API 。。。。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |