mIRC Home    About    Download    Register    News    Help

Print Thread
executing urls #72817 26/02/04 01:39 AM
Joined: Jul 2003
Posts: 742
MTec89 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
how can i execeute a URL, without opening a browser window?


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: executing urls #72818 26/02/04 01:49 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
What else can you do with a URL?

Re: executing urls #72819 26/02/04 01:54 AM
Joined: Jul 2003
Posts: 742
MTec89 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
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


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: executing urls #72820 26/02/04 02:12 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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


-KingTomato
Re: executing urls #72821 26/02/04 02:46 AM
Joined: Jul 2003
Posts: 742
MTec89 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
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


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: executing urls #72822 26/02/04 04:31 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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


-KingTomato
Re: executing urls #72823 26/02/04 04:41 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
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

Re: executing urls #72824 26/02/04 04:49 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I was close >:D

Thnx online grin


-KingTomato