How to read html url as string

Just starting out? Need help? Post your questions and find answers here.
Rjevsky
Posts: 3
Joined: Fri Sep 08, 2017 8:27 am

How to read html url as string

Post by Rjevsky »

how to read HTML from url for processing as strings for parsing and extract info?
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: How to read html url as string

Post by Peter »

Rjevsky wrote:how to read HTML from url for processing as strings for parsing and extract info?
do you mean the URL-Parameters? Then you can use ProgramParameter()

-> http://www.spiderbasic.com/documentatio ... meter.html

Greetings ... Peter
Rjevsky
Posts: 3
Joined: Fri Sep 08, 2017 8:27 am

Re: How to read html url as string

Post by Rjevsky »

Forgive me for my bad English. I want to get HTML pages.

For example from http://anyurl.com
I want to receive:

Code: Select all

 <!DOCTYPE html>
<html>
<head>
<title>...</title>
</head>
<body>
....
</body>
</html> 
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: How to read html url as string

Post by Peter »

Rjevsky wrote:I want to get HTML pages.
this is not that easy because of the Same-Origin-Policy

Here's a little trick using whateverorigin:

Code: Select all

Procedure ScrapPageCallback(Result.s)
  Debug Result
EndProcedure

Procedure ScrapPage(Url.s, Callback)
  ! $.getJSON('http://www.whateverorigin.org/get?url=' + encodeURIComponent(v_url) + '&callback=?', function(data){
  !   v_callback(data.contents);
  ! });
EndProcedure

ScrapPage("http://www.spiderbasic.com", @ScrapPageCallback())
Note, that is only a temporary solution. The better way is to run a little php-snippet on your own server:
http://forums.spiderbasic.com/viewtopic ... 1848#p1848

Greetings ... Peter
Rjevsky
Posts: 3
Joined: Fri Sep 08, 2017 8:27 am

Re: How to read html url as string

Post by Rjevsky »

Peter wrote:The better way is to run a little php-snippet on your own server
Thanks for the help. Can I make it even easier: to display the page from my web server? (I need it for the android application)
falsam
Posts: 280
Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:

Re: How to read html url as string

Post by falsam »

Rjevsky wrote:Can I make it even easier: to display the page from my web server?
WebGadget() ?

➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
http://falsam.com

Sorry for my poor english
Post Reply