get URL returns html source, not displayed text

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
david@ninetrees.com
Posts: 1
Joined: Tue Apr 20, 2010 4:44 am

get URL returns html source, not displayed text

Post by david@ninetrees.com » Sun Nov 18, 2012 8:17 am

when doing a get URL "" request, I was surprised that it returned the source of the web page.
How do I return the viewed text of the web page?
Thanks.

Code: Select all

on mouseUp
   get URL "..."
   put line 1 to 30 of it into field "textHolder"
 end mouseUp

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: get URL returns html source, not displayed text

Post by paulsr » Sun Nov 18, 2012 11:40 am

david@ninetrees.com wrote:when doing a get URL "" request, I was surprised that it returned the source of the web page.
How do I return the viewed text of the web page?
Thanks.

Code: Select all

on mouseUp
   get URL "..."
   put line 1 to 30 of it into field "textHolder"
 end mouseUp
David, that's what get url is supposed to do. It gets the raw file. You need to strip out the html tags with something like:

Code: Select all

on mouseUp
   get URL "..."
   set the htmlText of fld "textHolder" to line 1 to 30 of it
 end mouseUp
[/quote]

You'll get the text without the tags, but it still may not be quite what you want, because without the html para breaks, what is a "line"?

But I think this shd help.

--paul

Post Reply