Atitit httpclient rest Interface Overview
table of Contents
1. Httpclient using http protocol client library and art methods 1
2.1. Upload and download files 2
2.2 Text html; reptiles collected 2
3. The specific procedure how 2
4. Cross-language pattern curl using 2 Cli
5. api mode using different languages and environments 3
5.3. Js browser environment ajax 3
5.4. Js node environment http module 3
6.1. Import urllib.request error, seemingly for gzip support is not good 4
Get post method
- Feature purpose why
- Upload and download files
- Text html; reptiles acquisition
- Submit forms, etc.
- How specific processes
HTTPServer connection, the received byte stream, if text may require transcoding (GBK UTF) to a string
command="D:\\prgrm\\bin\\curl.exe http://localhost:8080/reg";
String rzt = IOUtils.toString(Runtime.getRuntime().exec(command).getInputStream(), "gbk");
System.out.println(rzt);
Doctrine default curl use gbk code reading. . So if the url output gbk
Iconv using transform coding or not ati tested.
curl http://www.baidu.com | iconv -f gb2312 -t utf-8 iconv
// get execution request.
CloseableHttpResponse response = HttpClients.createDefault().execute(new HttpGet(url));
// Get the response entity
String html = EntityUtils.toString(response.getEntity());
return html;
from bs4 import BeautifulSoup, Comment
import urllib.request
import requests
response = urllib.request.urlopen('http://www.qq.com/')
##html = response.read().decode('UTF-8','ignore')
#html = response.read().decode('gb2312','ignore')
# print (html)
r = requests.get('http://www.qq.com/')
print(r.text)
Atitit python get html source code