How do you use HTTPS to initiate a request to get the content?
I can use luasocket to initiate HTTP requests for get or post to get content, but recently there is a project, the HTTPS protocol,who knows how to initiate a HTTPS request to get the content of the web page ?
Hi,
You don’t need to use Lua sockets for network requests, Corona already has a library for that.
https://docs.coronalabs.com/api/library/network/request.html#examples
-dev
emmmm… I used this function network.request() ,But what I got was event.response:
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor=“white”>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
I open the same URL on the browser to get the content normally, URL is: https://m.yushuwu.net/novel/64884.html,
the code:
function networkListener6( event ) if ( event.isError ) then print(event.status) else print("---------------------------------------") print(event.response) end end url = "https://m.yushuwu.net/novel/64884.html" headers = {} local params = {} params.headers = headers params.body = body network.request(url, "GET", networkListener6, params )
Hi,
Is this a website you control? From looking at the console log the content seems fairly protected, it also appears to perform a redirect as well. You might be able to access it from a WebView.
64884.html:1 The SSL certificate used to load resources from https://changyan.sohu.com will be distrusted in M70. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information. base.js?v=a268e553c0e76f07666994a8f690d938:299 A parser-blocking, cross site (i.e. different eTLD+1) script, https://m.dnfeu.com/22337.html?, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details. yzw\_tool\_4 @ base.js?v=a268e553c0e76f07666994a8f690d938:299 base.js?v=a268e553c0e76f07666994a8f690d938:299 A parser-blocking, cross site (i.e. different eTLD+1) script, https://m.dnfeu.com/22337.html?, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details. yzw\_tool\_4 @ base.js?v=a268e553c0e76f07666994a8f690d938:299 64884.html:1 The SSL certificate used to load resources from https://0d077ef9e74d8.cdn.sohucs.com will be distrusted in M70. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information. 64884.html:1 Mixed Content: The page at 'https://m.yushuwu.net/novel/64884.html' was loaded over HTTPS, but requested an insecure image 'http://pages.ctrip.com/you/medals/medal\_4.png?allianceid=764242&sid=1310152&ouid=000401app-&utm\_medium=&utm\_campaign=&utm\_source=&isctrip='. This content should also be served over HTTPS.
-dev
WebView can be opened, but I want to get the content of the page in the background for further processing. The task I received was to develop the mobile phone end app of the site. It was obviously not suitable to create a WebView window directly on the mobile phone. I can only get the content from this address now, emmmm. Is there any way that I can get the content of the website? for variable . I used network.request () and other HTTPS tests can get content directly, but I can’t do this URL. I don’t know where the problem is. Url:https://m.yushuwu.net/novel/64884.html
Hi,
You don’t need to use Lua sockets for network requests, Corona already has a library for that.
https://docs.coronalabs.com/api/library/network/request.html#examples
-dev
emmmm… I used this function network.request() ,But what I got was event.response:
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor=“white”>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
I open the same URL on the browser to get the content normally, URL is: https://m.yushuwu.net/novel/64884.html,
the code:
function networkListener6( event ) if ( event.isError ) then print(event.status) else print("---------------------------------------") print(event.response) end end url = "https://m.yushuwu.net/novel/64884.html" headers = {} local params = {} params.headers = headers params.body = body network.request(url, "GET", networkListener6, params )
Hi,
Is this a website you control? From looking at the console log the content seems fairly protected, it also appears to perform a redirect as well. You might be able to access it from a WebView.
64884.html:1 The SSL certificate used to load resources from https://changyan.sohu.com will be distrusted in M70. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information. base.js?v=a268e553c0e76f07666994a8f690d938:299 A parser-blocking, cross site (i.e. different eTLD+1) script, https://m.dnfeu.com/22337.html?, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details. yzw\_tool\_4 @ base.js?v=a268e553c0e76f07666994a8f690d938:299 base.js?v=a268e553c0e76f07666994a8f690d938:299 A parser-blocking, cross site (i.e. different eTLD+1) script, https://m.dnfeu.com/22337.html?, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details. yzw\_tool\_4 @ base.js?v=a268e553c0e76f07666994a8f690d938:299 64884.html:1 The SSL certificate used to load resources from https://0d077ef9e74d8.cdn.sohucs.com will be distrusted in M70. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information. 64884.html:1 Mixed Content: The page at 'https://m.yushuwu.net/novel/64884.html' was loaded over HTTPS, but requested an insecure image 'http://pages.ctrip.com/you/medals/medal\_4.png?allianceid=764242&sid=1310152&ouid=000401app-&utm\_medium=&utm\_campaign=&utm\_source=&isctrip='. This content should also be served over HTTPS.
-dev
WebView can be opened, but I want to get the content of the page in the background for further processing. The task I received was to develop the mobile phone end app of the site. It was obviously not suitable to create a WebView window directly on the mobile phone. I can only get the content from this address now, emmmm. Is there any way that I can get the content of the website? for variable . I used network.request () and other HTTPS tests can get content directly, but I can’t do this URL. I don’t know where the problem is. Url:https://m.yushuwu.net/novel/64884.html