菜单

use methods associated with the object it returns to find out particulars about the HTTP (or FTP) response itself.

2019年6月12日 - Php
require 'open-uri'

f = open('http://www.rubyinside.com/test.txt')

puts f.content_type
puts f.charset
puts f.last_modified

曾经设置了User-Agent依旧相当

 java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.dianping.com/shop/93433662 at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at com.Utils.MyFunction.httpRequest(MyFunction.java:37) at com.net.service.DianPing.getDianPing(DianPing.java:41) at com.net.service.TodayTemperatureService.getDianPing(TodayTemperatureService.java:164) at com.net.service.TodayTemperatureService.main(TodayTemperatureService.java:174)
 URL url = new URL(requestUrl); httpUrlConn = (HttpURLConnection) url.openConnection(); httpUrlConn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");

Server returned HTTP response code: 403 for URL:
Java代码中访问链接提醒java.io.IOException: Server returned HTTP response
code: 40三 for U酷路泽L: 错误

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图