Avatar billede pizzamania Nybegynder
13. april 2001 - 17:38 Der er 18 kommentarer og
1 løsning

Web fetching ???

Does anyone have a script where you can get something from a web site automaticly and save it in a mdb or SQL database ?
Avatar billede tdaugaard Nybegynder
13. april 2001 - 17:43 #1
You\'ll need a component called ASPTear or ASPHTTP ... but they need to be installed on the server on where you need to do it.
Avatar billede pizzamania Nybegynder
13. april 2001 - 17:46 #2
Do you have a example of a script like that ?  Wich saves the information in a database ?
Avatar billede netsrac Praktikant
13. april 2001 - 17:53 #3
ASPHttp:

Set HttpObj = Server.CreateObject(\"AspHTTP.Conn\")
HTTPObj.Url = \"http://www.eksperten.dk\"
HTTPObj.PostData = \"\"
HTTPObj.RequestMethod = \"GET\"
strResult = HTTPObj.GetURL
Avatar billede pizzamania Nybegynder
13. april 2001 - 17:58 #4
But how can you save the information in a database ?

Could you help me with a example script..

In the example you can for example use it to get the five latest jobs from this web site: http://www.eksperten.dk/job/stilling/

Or anything else... Can you please help me ?
Avatar billede netsrac Praktikant
13. april 2001 - 18:04 #5
Set HttpObj = Server.CreateObject(\"AspHTTP.Conn\")
HTTPObj.Url = \"http://www.eksperten.dk\"
HTTPObj.PostData = \"\"
HTTPObj.RequestMethod = \"GET\"
strResult = HTTPObj.GetURL
set HTTPObj = nothing

Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\" & Server.MapPath(\"database.mdb\") & \";UID=admin;PWD=;\"
conn.execute(\"insert into tabel (fieldname) VALUES(\'\" & strResult & \"\')\")
set conn = nothing
Avatar billede pizzamania Nybegynder
13. april 2001 - 18:08 #6
Thanks a lot netsrac... 

But how can you actually set it to get for example the jobs at ?:

http://www.eksperten.dk/job/stilling/

I need that because I will for example need it to get news headlines. etc. from some pages...
Avatar billede netsrac Praktikant
13. april 2001 - 18:12 #7
You will have to find a pattern in the output from the page, and then sort into the output with left(), right(), mid(), split() and so on.
Avatar billede pizzamania Nybegynder
13. april 2001 - 18:16 #8
?????

I got this script in perl, wich gets the Oil price, how would you put that into the script you had, and how would the database look like?


#!/perl/bin/perl.exe

use LWP::Simple;

print \"content-type:text/html\\n\\n\";

unless ( $source=get(\"http://www.bloomberg.com/markets/future.html\") )
{
print \"Error: Bloomberg.com is down!\";
exit;
}

$source =~ m#.*<NOBR>(BRENT CRUDE FUTR)</NOBR>.*\\n.*<SPAN CLASS=\"mrktdata1\">(.*)</SPAN>.*\\n.*<SPAN CLASS=\"mrktdata1\">(.*)</SPAN>.*\\n.*<SPAN CLASS=\"mrktdata1\">(.*)</SPAN>.*\\n.*<SPAN CLASS=\"mrktdata1\">(.*)</SPAN>.*\\n.*<SPAN CLASS=\"mrktdata1\">(.*)<BR>(.*)</SPAN>.*\\n.*<SPAN CLASS=\"mrktdata1\">(.*)</SPAN>.*#i;
print \"$1 $2 $3 $4 $5 $6 $7 $8\";
Avatar billede netsrac Praktikant
13. april 2001 - 18:19 #9
I dont know anything about perl...
Avatar billede pizzamania Nybegynder
13. april 2001 - 18:21 #10
But you can se how I get it,, wouldnt it be possible to use something like this to get something from a page ?
Avatar billede netsrac Praktikant
13. april 2001 - 18:25 #11
What do you want from the page ?
Avatar billede pizzamania Nybegynder
13. april 2001 - 18:30 #12
How would you for example grab these headlines using the ASP you talked about:

http://www.guardian.co.uk/Distribution/Artifact_Trail_Block/0,5184,179475-0-5,00.html


And put the headline, and the bit of text and the URL to each news into the database ?
Avatar billede pizzamania Nybegynder
13. april 2001 - 18:32 #13
From the http://www.bloomberg.com/markets/future.html

page..
I wanted the:
CRUDE OIL FUTR
May01 13:20 28.60 0.42 28.55 28.84
28.50 28.18

under ENERGY..
Avatar billede netsrac Praktikant
13. april 2001 - 18:40 #14
Set HttpObj = Server.CreateObject(\"AspHTTP.Conn\")
HTTPObj.Url = \"http://www.eksperten.dk\"
HTTPObj.PostData = \"\"
HTTPObj.RequestMethod = \"GET\"
strResult = HTTPObj.GetURL
set HTTPObj = nothing

pos = instr(strResult, \"CRUDE OIL FUTR\")
last2 = \"\"
do while last2 <> \"TR\"
tmp = tmp & mid(strresult, pos, 1)
pos = pos +1
last2 = mid(strresult, (pos-1), 1) & mid(strresult, pos, 1)
loop

Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\" & Server.MapPath(\"database.mdb\") & \";UID=admin;PWD=;\"
conn.execute(\"insert into tabel (fieldname) VALUES(\'\" & tmp & \"\')\")
set conn = nothing
Avatar billede pizzamania Nybegynder
13. april 2001 - 19:08 #15
I dont have actually the ASPHTTP component installed...  Could you set it up on your server, so I can se how it looks like ?
Avatar billede netsrac Praktikant
13. april 2001 - 19:35 #16
I dont have ASPHttp...
Avatar billede pizzamania Nybegynder
17. juni 2001 - 13:28 #17
Ingen svar, som fortjener poeng..
Avatar billede pizzamania Nybegynder
17. juni 2001 - 13:28 #18
Ingen svar, som fortjener poeng...!!!!!!!!!!!
Avatar billede netsrac Praktikant
17. juni 2001 - 13:35 #19
Et mirakel, pludselig kunne han tale Dansk.

Svineri at du bare tager alle pointene igen...
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester