mIRC Homepage
Posted By: MTec89 executing urls - 26/02/04 01:39 AM
how can i execeute a URL, without opening a browser window?
Posted By: Online Re: executing urls - 26/02/04 01:49 AM
What else can you do with a URL?
Posted By: MTec89 Re: executing urls - 26/02/04 01:54 AM
i want to send data to the server but i dont want a window to open i can send the data just by the url
Posted By: KingTomato Re: executing urls - 26/02/04 02:12 AM
Sockets?

Code:
alias url2 {
  var %link = $1-, %sock = $+(url,$rand(1,999))

  /sockopen %sock $url_parse(%link).host $url_parse(%link).port
  /sockmark %sock %link
}

alias url_parse {
  var %link = $1-, %url = $remove($1-,http://)
  var %host = $gettok($+(%url,/), 1, $asc(/))
  var %path = $iif($mid(%url, $calc($len(%host)+1)), $ifmatch, /)
  var %port = 80

  if (*:* iswm %host) {
    var %port = $gettok(%host, 2, $asc(:))
    var %host = $gettok(%host, 1, $asc(:))
  }

  if ($isid) {
    if ($prop == host) return %host
    else if ($prop == path) return %path
    else if ($prop == port) return %port
  }
  else /echo -s Sytax Error: $+($,url_parse) must be used as an identifier
}

on *:SOCKOPEN:url*: {
  if ($sockerr) /echo -s Error opening connection to 
  else {
    var %link = $sock($sockname).mark
    /sockwrite -n $sockname GET $url_parse(%link).path HTTP/1.0
    /sockwrite -n $sockname Host: $url_parse(%link).host
    /sockwrite -n $sockname $crlf
  }
}

on *:SOCKREAD:url*: {
  ; if you want what actually is returned, do it here
  ;var %win = $+(@,$sockname)
  ;if (!$window(%win)) /window %win
  ;/sockread -f %data
  ;/echo %win -> %data
}


works like /url, just doesn't open a window.

/url2 http://www.google.com/search?q=KingTomato

I also have it to accept ports. i.e.

/url2 :81[/b]/search?q=KingTomato]http://www.google.com:81/search?q=KingTomato
Posted By: MTec89 Re: executing urls - 26/02/04 02:46 AM
seems logical but ti doesnt seem to want to take the info im sending the server via sockets but if i use the browser it works
Posted By: KingTomato Re: executing urls - 26/02/04 04:31 AM
Some servers require more information than just the GET and Host headers. I'd try adding Accept, as well as perhaps mayeb you need a cookie. Look online for a program called Ethereal, and watch the pakcets you send and recieve. You can just click on the packets until you find the one you want, then right click and "show this stream" (or something to that effect). Ethereal is just a packet capturing utitly >:D
Posted By: Online Re: executing urls - 26/02/04 04:41 AM
Yea, something like that. You open up Ethereal, go to 'Capture' menu and press 'Start...'. Then you navigate your browser to wherever you like and press 'Stop' in the capturing window. After Ethereal finishes loading everything, right click on the packet whose info starts with 'GET ...' and select 'Follow TCP Stream'

Cheers laugh
Posted By: KingTomato Re: executing urls - 26/02/04 04:49 AM
I was close >:D

Thnx online grin
© mIRC Discussion Forums