1. ? ?
  2. PowerServer 2020 or older (Obsolete)
  3. Wednesday, 6 April 2022 08:51 AM UTC

请问下,在手机端 怎样可以取到一个网页的源码内容 , thank 

Kai Zhao @Appeon Accepted Answer Pending Moderation
  1. Friday, 8 April 2022 01:07 AM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 1

你好,

请尝试使用httpclient对象,比如:

Integer li_rc
String ls_string
HttpClient lnv_HttpClient
lnv_HttpClient = Create HttpClient

// Sends request using GET method
li_rc = lnv_HttpClient.SendRequest("GET", "https://demo.appeon.com/PB/webapi_client/employee/102")
// Obtains the response data
if li_rc = 1 and lnv_HttpClient.GetResponseStatusCode() = 200 then
lnv_HttpClient.GetResponseBody(ls_string)
end if

destroy lnv_HttpClient

messagebox('', ls_string)

 

Regards,
ZhaoKai

Comment
There are no comments made yet.
? ? Accepted Answer Pending Moderation
  1. Thursday, 7 April 2022 10:54 AM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 2

inet iinet_base
iir_msgbox = CREATE n_ir_msgbox
if GetContextService("Internet", iinet_base) = 1 THEN
iinet_base.GetURL("http://192.168.0.162/api.php?location=29.888127,113.124542&id=1", iir_msgbox)
END IF
DESTROY iir_msgbox
ls=str_info_from_web

messagebox("",ls)

 

你好,我用上面代码 在电脑上运行就可以读取到 网页显示的内容,但我直接在手机端用上面的一样的代码,就不行,取不到数据为什么?

 

Comment
There are no comments made yet.
Kai Zhao @Appeon Accepted Answer Pending Moderation
  1. Thursday, 7 April 2022 00:27 AM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 3

你好,

你可以使用inet对象获取,需要通过InternetResult获取InternetData,请参考下面文章介绍.
https://www.cnblogs.com/flish/p/6287521.html

Regards,
Kai

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.