You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
636 B
29 lines
636 B
import requests
|
|
from bs4 import BeautifulSoup
|
|
|
|
# 目标网站的URL
|
|
url = "https://m.xingming.com/haoma/shouji.php"
|
|
|
|
# 准备要发送的数据,通常为字典格式
|
|
data = {
|
|
'sjhao': '18686619970',
|
|
'submit': '开始测试',
|
|
'action': 'test'
|
|
}
|
|
|
|
# 发送POST请求
|
|
response = requests.post(url, data=data)
|
|
|
|
# 检查请求是否成功
|
|
if response.status_code == 200:
|
|
pass
|
|
else:
|
|
print("请求失败,状态码:", response.status_code)
|
|
|
|
# 打印响应内容
|
|
soup = BeautifulSoup(response.text, "html.parser")
|
|
|
|
for i in range(4, 6):
|
|
elements = soup.select("p")[i]
|
|
print(elements)
|