PDA

View Full Version : Get webpage output via Linux script ?


Slime
29-05-2001, 15:31
Guys,

It's probably stupidly easy.....but does anyone know how i can (within a script) issue an internet URL and use the information displayed on the web page - scripted.

The URL i issue is very specific and returns pure text information. I then need to search through this and display the info to the user running the script ?

It's the first part i'm really stumped on.....

Cheers
Slime

Godin
29-05-2001, 15:54
youd prolly need to open a socket and retrieve the data, mabee using http headers, what language u trying to do it in?

Slime
29-05-2001, 17:03
Bash shell script.

Slime

Skunk
29-05-2001, 20:33
Use lynx - you can run lynx from a command line and tell it to simply grab a page and save it as a file. Stick that in your shell script, then open the file and do stuff to it.

I don't know the exact syntax, but thsi is how you pipe lynx do /dev/null:lynx -dump http://www.yourdomain.com/page.html >> /dev/null

aef
29-05-2001, 20:42
/me returns after weekend

Yep: lynx -dump if you want the lynx-rendered output, lynx -dump -source if you want the HTML source.

If you're writing a non-trivial script in bash then you should probably be using Perl or something similar.

AEF

Slime
29-05-2001, 22:44
Good stuff - thanks guys :)

Anywhere nice aef ?

Slime

aef
30-05-2001, 19:44
Originally posted by Slime
Anywhere nice aef ?

Just somewhere that wasn't London :)

AEF