Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | |||
archiv:coding:msl:http-socket [2022/11/20 23:34] – psycore | archiv:coding:msl:http-socket [2023/11/18 19:36] (aktuell) – psycore | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== HTTP Socket ====== | ||
+ | {{template> | ||
+ | |||
+ | ===== Code Template ===== | ||
+ | |||
+ | <code mirc> | ||
+ | alias urlencode { | ||
+ | var %a = $regsubex($$1,/ | ||
+ | return $replace(%a, | ||
+ | } | ||
+ | |||
+ | alias nfquery { | ||
+ | sockopen nquery www.host.de 80 | ||
+ | } | ||
+ | |||
+ | on *: | ||
+ | var %nquery.var = msg= $+ $urlencode(%nquery.msg) $+ &nick= $+ $urlencode(%nquery.nick) | ||
+ | var %nquery.host = www.host.de | ||
+ | var %nquery.get = / | ||
+ | sockwrite -n nquery GET %nquery.get | ||
+ | sockwrite -n nquery Host: %nquery.host | ||
+ | sockwrite -n nquery $crlf | ||
+ | } | ||
+ | |||
+ | on *: | ||
+ | unset %nquery.nick | ||
+ | unset %nquery.msg | ||
+ | sockclose nquery | ||
+ | } | ||
+ | |||
+ | on *:open:?: { | ||
+ | set %nquery.nick $nick | ||
+ | set %nquery.msg $1- | ||
+ | nfquery | ||
+ | } | ||
+ | </ |