mIRC Home    About    Download    Register    News    Help

Print Thread
#196270 14/03/08 01:42 AM
Joined: Aug 2006
Posts: 183
T
Thrull Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Aug 2006
Posts: 183
The following code doesn't work. Anyone know why? I can't for the life of me figure out what I'm doing wrong.

Code:
Alias RpgGet {
  sockopen IdleRPGCheck www.idlerpg.eu 80
  /window -e @RPGTest1
}

on 1:sockopen:IdleRPGCheck: {
  sockwrite -nt IdleRPGCheck GET /players.php
  if $error != $null {
    echo Error! $error
    sockclose *
  }
}

on *:sockread:IdleRPGCheck: {
  sockread %RPG.temp
  if ($sockbr == 0) { goto End } 
  if (%RPG.temp == $null) %RPG.temp = -
  if ($sockbr > 930) %RPG.Temp = $left(%RPG.temp, 930)
  echo @RPGTest1 %RPG.Temp
}


www.idlerpg.eu exists and works fine with my browser. www.idlerpg.eu/players.php exists and works fine with my browser. For whatever reason, when I try and read the website using Mirc's sockets I get this.

Quote:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /players.php was not found on this server.</p>
<hr>
<address>Apache Server at server.reusitii.com Port 80</address>
</body></html>


Any help? Please?? confused

Edit: Can't type.

Edit 2: Got it working. I'm just a newbie. frown

Code:
Alias RpgGet {
  sockopen IdleRPGCheck idlerpg.eu 80
  window -e @RPGTest1
}

;-----------------------Read Player List
on 1:sockopen:IdleRPGCheck: {
  ;/echo -a Opened Socket
  sockwrite -n IdleRPGCheck GET /players.php HTTP/1.1
  sockwrite -n $sockname Host: www.idlerpg.eu $+ $crlf $+ $crlf
  if $error != $null {
    /echo Error! $sockerr
    /sockclose *
  }
}

on *:sockread:IdleRPGCheck: {
  sockread %RPG.temp
  if ($sockbr == 0) { goto End } 
  if (%RPG.temp == $null) %RPG.temp = -
  if ($sockbr > 930) %RPG.temp = $left(%RPG.temp, 930)
  echo @RPGTest1 %Rpg.Temp
}

Last edited by Thrull; 14/03/08 02:45 AM.

Yar
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As a note, most of the time, you should be using HTTP/1.0 instead of HTTP/1.1 .


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard