Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Dec 11, 2018 10:26 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: get_links method
PostPosted: Sun Oct 09, 2005 6:06 am 
Offline

Joined: Sun Oct 09, 2005 5:50 am
Posts: 2
Location: England
I'm trying to write a method for my friend application. The method doesn't need to run by itself it will be implemented into his app. I'm fairly new to REALBasic, I have a lot of experience with PHP and I once did a bit of QuickBasic when I was 8.

Anyway the method I'm trying to create basically gets the HTML output of a dynamically produced webpage from a URL passed to it (preferably as a string) and then split it all up into HTML tags and put each tag (open and closed tag as well as the text between them) in a seperate array value. Then it needs to look for all the link tags (ones that start with 'a href') and put those in a new array along with their text. Then it needs to search through the new array for links that link to files with a certain extension also passed into the method.

The bit I'm stuck on is getting the HTML as a string. I was thinking of using the HTTPSocket class to do it but I'm not sure how to use it properly. The rest should be fairly easy as I will use a function similar to the PHP explode function (if one exists) and a few for loops (or foreach loops if they exist) to loop through the arrays.

My method so far looks like this:
method get_links(URL as String, search as String) As links as Array
dim html as new HTTPSocket
html.Yield = true


Really I just need to know if I can write something like:
dim alltags as String
alltags = html.Get(URL)


an explode() or split() function would also be useful.

Any input would be welcome, thanks.

EDIT:
I've just looked at the Language Reference and found a Split function which helps a lot. Now all I need is that HTML string...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Oct 09, 2005 1:36 pm 
Offline

Joined: Sun Oct 09, 2005 5:50 am
Posts: 2
Location: England
Thanks! It was a big help, but my main problem is that I don't know how to get the content of the webpage into a string using the HTTPSocket class...


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group