[File reading and writing] Save pictures on the web page

1. Main business processes:

Read the names of the pictures in sequence from the txt file, and save the pictures on the web page to the local folder through the URL

2. Code:

Insert image description hereInsert image description hereInsert image description here

3. 报错:Server returned HTTP response code: 403 for URL

solve:

URL url = new URL(requestUrl);
httpUrlConn = (HttpURLConnection) url.openConnection();
httpUrlConn.setRequestProperty("UserAgent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");

Guess you like

Origin blog.csdn.net/m0_46459413/article/details/128806042