mIRC Home    About    Download    Register    News    Help

Print Thread
D
Def1ant
Def1ant
D
Hi,

So basicly I'm trying to get a file from my website with mirc by using sockets (sock open, read & write etcetc). While this does work for 'normal' websites (read: google.com etc), this doesn't for my own. I'm guessing this is because i used cheap hosting, which is shared. Due to this, the real domain is just fake, and points towards a directory on a shared domain. Asking a file on my domain won't work, i need to use the indirect path i guess.. however, here are too many dots in the link which caused mirc to get confused :p

In short:
I want to read the file: www.takkra.nl/cb/test.txt
This only goes via http://takkra.nl.server2.starthosting.nl/cb/test.txt
But as you can see there's too many dots in this link.

Is there anyone that knows a workaround for this? Below I've added a simple script to try n get it to work..

Code:
Alias Update {
  if ($sock(update)) { sockclose update }
  sockopen update takkra.nl.server2.starthosting.nl 80
  :end
}

on *:sockopen:update:{
  sockwrite -n update GET /cb/test.txt HTTP/1.0
  sockwrite -n update Host: takkra.nl.server2.starthosting.nl 80
  sockwrite -n update $crlf
}

on *:sockread:update:{
  sockread %update
  if %update { echo -a %update }
}

Last edited by Def1ant; 27/11/08 01:42 PM.
G
genius_at_work
genius_at_work
G
Most likely is that the server is expecting some other header data from your socket connection. Such as the browser name, content type, etc. You may be able to use a http analyzer to figure out what it is looking for.

-genius_at_work

_
_Memo
_Memo
_
cleaned up your code and malformed syntaxes in the HTTP requests, it works now.

Code:
Alias Update {
  if ($sock(update)) sockclose update
  sockopen update www.takkra.nl 80
}

on *:sockopen:update:{
  sockwrite -n update GET /cb/test.txt HTTP/1.1
  sockwrite -n update Host: www.takkra.nl
  sockwrite -n update $crlf
}

on *:sockread:update:{
  var %r
  while (reading) {
    sockread -f %r
    if ($sockerr) {
      echo -a Socket error $sockerr
      break
    }
    echo -a Data: %r
    if (!$sockbr) break 
  }
}



D
Def1ant
Def1ant
D
Aha, thanks for the help. Was affraid the many dots were the issue, instead it was bad coding. Thank you wink


Link Copied to Clipboard