|
Joined: Jun 2003
Posts: 4
Self-satisified door
|
OP
Self-satisified door
Joined: Jun 2003
Posts: 4 |
I can get this Google Searcher to work, anyone got an idea of whats wrong? alias search { sockclose google set %search $replace($1-,$chr(32),+) sockopen google www.google.com 80 } on *:sockopen:google:{ if ($sockerr > 0) { return } sockwrite -n google GET /search?q= $+ %search $+ &ie=UTF-8&oe=UTF-8&hl=en&meta=) sockwrite -n google HOST www.google.com $+ $crlf $+ $crlf } on *:sockread:google:{ sockread %result echo -a $chr(32) $htmlfree(%result) } alias htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) return %x }
/server -m 216.152.65.156 /join #project64
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
there's no need to post the same question on multiple boards, just simply post on 1 board and be patient for your answer(s)
new username: tidy_trax
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
as was pointed on on the other board... sockwrite -n google GET /search?q= $+ %search $+ &ie=UTF-8&oe=UTF-8&hl=en&meta=) sockwrite -n google HOST www.google.com $+ $crlf $+ $crlf needs to be more like.. sockwrite -n google GET /search?q= $+ %search HTTP/1.0 sockwrite -n google HOST www.google.comsockwrite -n google $crlf It might be better if u had atleast some farmiliarity with the http protocol
-KingTomato
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
Actually that's wrong, first you need a : after the word "host", and second you don't need the $crlf at the end of the third sockwrite..
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
sockclose google set %search $replace($1-,$chr(32),+) sockopen google www.google.com 80 /sockmark google /search?q= $+ %search $+ &ie=UTF-8&oe=UTF-8&hl=en&meta=) } on *:sockopen:google:{ if ($sockerr > 0) { return } sockwrite -n google GET $sock($sockname).mark HTTP/1.1 sockwrite -n google ACCEPT: */* sockwrite -n google HOST: www.google.com $+ $crlf $+ $crlf } on *:sockread:google:{ sockread %result echo -a $chr(32) $htmlfree(%result) } alias htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) return %x }
new username: tidy_trax
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
heh..knew i shouldn't have attepted that b4 i went to bed. Yes, hopst: has a colon, and the crlf is so there is a file return after the host is sent, symbolizing EOH (end of header). Anyways, if you don't put tsomething, it gives the "insifficient params" line >:\
-KingTomato
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
Anyways, if you don't put tsomething, it gives the "insifficient params" line >:\ Not for me, I have many HTTP scripts that do it, all of them use sockwrite -n $sockname, the -n sends a $crlf, don't need another $crlf. I like quibbling over details.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
-KingTomato
|
|
|
|
Joined: Mar 2003
Posts: 50
Babel fish
|
Babel fish
Joined: Mar 2003
Posts: 50 |
However, even using -n sometimes doesnt work and you will still get the invalid parameters error. I had this happen commenly on sites using IIS 5+ where I had to actually send a seperate $crlf all by its lonesome. Unsure why IIS has this problem at times, maybe its the way its waits for the entire header sequence.
|
|
|
|
|