mIRC Home    About    Download    Register    News    Help

Print Thread
#57725 26/10/03 07:13 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
ok i know some very basic stuff about sockets but idk how to do this
what i am trying to do is show the front page headlines off of any one know of how to come by doing this? (Here)


Need amazing web design for low price: http://www.matrixn3t.net
#57726 26/10/03 07:58 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
This tutorial explains how to make HTTP requests. You need to connect www.m[/b]snbc.com on port 80 and retrieve "/news/news_front.asp?0dm=C10RN&ta=y".

After you send the HTTP request, a sockread event will trigger with the page data, allowing you to parse it and pull the relevant headlines. Parsing isn't always easy. If you have troubles, paste here what you've got so far and we'll try to help.

#57727 26/10/03 07:59 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
k thx for the pointers


Need amazing web design for low price: http://www.matrixn3t.net
#57728 26/10/03 10:09 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
ok i have figured out how to connect to the site and echo it out but the tut says nothing about what u said online =/

Code:
alias msnbccon { /sockopen hdesk1 www.msnbc.com 80 }
on *:SOCKOPEN:hdesk*: { 
  echo -s *** $sockname ( $+ $sock($sockname).ip $+ ) opened 
  sockwrite -n $sockname GET /news/news_front.asp?0dm=C10RN&ta=y HTTP/1.1 
  sockwrite -n $sockname Host: msnbc.com 
  sockwrite -n $sockname Connection: keep-alive 
  sockwrite $sockname $crlf 
} 
on *:SOCKCLOSE:hdesk*: echo -s *** $sockname ( $+ $sock($sockname).ip $+ ) closed. 
on *:SOCKREAD:hdesk*: { 
  sockread %temp 
  if (%temp) echo -s %temp 
} 


Need amazing web design for low price: http://www.matrixn3t.net
#57729 26/10/03 11:42 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Yea the tutorial is very basic and doesn't go into details of using binary variables or parsing text.

Now you need to learn the page structure and see where you start pulling the headlines, and where you finish and close the connection. When you view the page in your browser, select "View source" to see the HTML stuff.

Assuming you want only the "Top Stories" section I created a small script that retrieves them, get it here (yeah, I know I suck at commenting... laugh). Feel free to ask any question about it...

Btw I changed HTTP/1.1 to 1.0. It's like asking the server to be more friendly and not to send back encoded data or other things we can't handle.

#57730 27/10/03 12:59 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
thanks for your help grin
erm one more thing how would i write this to a dialog edit box? i would set it to a var then tok it or something?

Last edited by ATMA; 27/10/03 01:11 AM.

Need amazing web design for low price: http://www.matrixn3t.net
#57731 28/10/03 06:28 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Well, at some stage I presume you're displaying it with /echo or such, so change that /echo to "/did <-a | -ra> dialogname ID .... "


Link Copied to Clipboard