VB.NET and querying a knowledge base.

Soldato
Joined
20 Jan 2005
Posts
2,722
Location
Whitley Bay
Hi folks,

I posted a thread on this earlier here but I'm a little further on now.

I've written a basic app in VB.NET and am now struggling to see how to use the value in a text field to search a knowledge base (this one if that helps).

Someone mentioned using an HTTP POST to pass the data to the webserver but being pretty new to this game I've not got much idea where to start.

Any help (or advice if it's even possible) would be massively appreciated!

TIA

Si
:)
 
Read up on HttpWebRequest / WebRequest classes. Basically these are the .Net classes which enable you to post / get pages and return a stream (html page etc).

Next get a program like Proximitron which will show you exactly what data you need to post (shows you what you computer sends to a website). This will allow your program to act like a browser; send information and get information back!
 
Hi there.

I managed to get the application to perform the searches I need and return the results in their respective webpages.

What I'd like to be able to do is extract the answer information from the tables on each page and create a local SQL table with all of the search results allowing me to show the results on one screen rather than spread between several webpages.

Does anyone have any idea how to extract the text and hyperlink information from a table on a website and place it into a simple SQL table?

An example table:


I might be asking something really obvious, or fairly obscure. I'm not good enough at this lark to be able to tell!

Thanks for any help.

Si
:)
 
You'd create a table with the columns description and link. In HTML the links will be such '<a href="somelink.html">Descriptive Text</a>'. You could create a regex which would pull all the links off the page (what I would do is search for the table (start and finish) to make sure you only get the links you want). It would look something like this:
<a\s+href="?(?<link>.+?)"?>(?<description).+?</a>

That will give you a match collection which you can loop through inserting into the table (w3schools have sample insert statements).

HTH.
 
Thanks for that Goksly.

I've managed to modify your regex and come up with the regex below which finds the string when I test it in Expresso:

(\ba\sclass="plain"\shref="\b)?(?<link>.+?)(topview=1")
Not sure how messy that is...

Anyway, that finds the correct lines in the html but I'm unsure how to extract the URL and place it in a text field or text file (I'm taking it one step at a time - tables can come later, as can extracting the description).

I'm working with a colleague who's using an HTTP socket request to pull the source code of the webpage locally rather than having the application searching through the data on the web.

Any idea how I tell my application to search this text file for the URL string?

Sorry for all the questions, if there's a useful resource somewhere that I should be reading please let me know!

Thanks

Si
:)
 
Back
Top Bottom