How to get a website's source ?

Hi, I'm a beginner in C++ and I need some help how to get a website's source code and save it into a string.
Also I want to know how can I then search the source for a specific keyword AND how can I "extract" a word between 2 keywords. Here's what I mean:

1
2
3
4
5
6
$source = _INetGetSource("http://www.google.com") ; get websites source
$stringBetween = _StringBetween($source,"a keyword","second keyword") ; this extracts a word between those two keywords

If StringInStr($source, "Google") Then ; this searches the source for a keyword Google
; do something
EndIf


This code is in autoit and I hope it'll help you understand what I need help with.
Last edited on
You need to know the address and name of the .htm or .html file that you're looking to reap the source from to give to the program (www.google.com/index.htm). After that, I imagine you could use fin or fscanf to find the first word, after it has, begin copying to the other file, until you come across the second word.

A do{}while() loop with a trio of if statements inside would probably do it (1st: if [word in buffer] == [1st keyword], then set begincopy = true; 2nd: if [word in buffer] == [2nd keyword], then set stopcopy = true; 3rd: if begincopy == true, then print [word in buffer into other file]; have the loop while(stopcopy != true) )
Last edited on
You'd be able to find all this stuff or ask it on autoit forums. I've used it myself its not to bad of script language. But you'll find more info on it at their forums.

:)
Topic archived. No new replies allowed.