mIRC Home    About    Download    Register    News    Help

Print Thread
#10911 13/02/03 05:17 PM
Joined: Feb 2003
Posts: 34
S
ST3V3 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Feb 2003
Posts: 34
ive made a simple socket update script and it doesnt work right...
Code:
 alias update { sockopen Update www.necron.pwp.blueyonder.co.uk 80 }
on *:SOCKOPEN:Update: { 
  echo -a Checking for updates...  
  sockwrite -n $sockname GET /smirc/updates.txt HTTP/1.0
  sockwrite -n $sockname Host: necron.pwp.blueyonder.co.uk
  sockwrite $sockname $crlf
}
on *:SOCKREAD:Update: { 
  if ($sockerr > 0) return 
  :nextread 
  sockread %version
  if ($sockbr == 0) return 
  if (%version) { echo %version } 
  goto nextread
}
 

it should echo the contents of updates.txt but it says
HTTP/1.1 200 OK
Server: Zeus/4.0
Date: Thu, 13 Feb 2003 17:17:29 GMT
Content-Length: 3
Accept-Ranges: bytes
Content-Type: text/plain
Last-Modified: Thu, 13 Feb 2003 16:18:53 GMT
Connection: close

any reasons why?

#10912 14/02/03 04:06 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
If you're going to use HTTP/1.1, then specify it in your GET statement. You've specified HTTP/1.0 and then gone on to give an HTTP header. You might try something like the following:
Code:

  sockwrite -n $sockname GET /smirc/updates.txt HTTP/1.1
  sockwrite -n $sockname Host: necron.pwp.blueyonder.co.uk
  sockwrite -n $sockname Accept: text/plain
  sockwrite -n $sockname User-Agent: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0b; Win32)
  sockwrite -n $sockname Pragma: no-cache
  sockwrite $sockname $crlf

Very impressive looking, isn't it? Especially when all you PROBABLY need is:
Code:

  sockwrite -n $sockname GET /smirc/updates.txt HTTP/1.0
  sockwrite $sockname $crlf

cool


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#10913 14/02/03 04:18 PM
Joined: Feb 2003
Posts: 34
S
ST3V3 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Feb 2003
Posts: 34
Hammer, it still doesnt work! the first example you said echoes:

First:

HTTP/1.1 200 OK
Server: Zeus/4.0
Date: Fri, 14 Feb 2003 16:12:22 GMT
Content-Length: 3
Accept-Ranges: bytes
Content-Type: text/plain
Last-Modified: Thu, 13 Feb 2003 16:18:53 GMT

and the second:

Second:

HTTP/1.1 404 Not found
Server: Zeus/4.0
Date: Fri, 14 Feb 2003 16:10:53 GMT
Connection: close
Accept-Ranges: bytes
Content-Type: text/html
<html>
<!-- Last modifications by Alex Brown webmaster@blueyonder.co.uk on 27/06/2002 -->
<head>
<title>Site or page not found</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
TD { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000}
-->
</style>
</head>
<body bgcolor="E6E6E6" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" width="1"><img src="http://www.blueyonder.co.uk/images/pwp/spacer.gif" width="1" height="32"
alt=""></td>
<td valign="middle"><img src="http://www.blueyonder.co.uk/images/pwp/404.gif" width="101" height="15" alt="404 - Not Found"></td>
</tr>
<td bgcolor="#000000" colspan="2"><img src="http://www.blueyonder.co.uk/images/pwp/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td bgcolor="#CDDEEE" colspan="2"><img src="http://www.blueyonder.co.uk/images/pwp/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td bgcolor="#6086A9"><img src="http://www.blueyonder.co.uk/images/pwp/spacer.gif" width="1" height="47" alt=""></td>
<td bgcolor="#6086A9"><img src="http://www.blueyonder.co.uk/images/pwp/spacer.gif" width="1" height="10" alt=""></td>
</tr>
<tr bgcolor="#000000">
<td colspan="2"><img src="http://www.blueyonder.co.uk/images/pwp/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2"><img src="http://www.blueyonder.co.uk/images/pwp/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan=2 align=center>
<br>
<table width=95%>
<tr>
<td>
<h2>404 Not Found</h2>
<p>There was no page found at this location. You may wish to report this to the owner of the site.</p>
<p>If you are the owner of this site, it is possible that you have an issue with upper and lower case characters
in your file names. See <b><a href="http://help.blueyonder.co.uk/publish/web_index.html">our helpsite</a></b> for
further information on how you should resolve this.</p>
<p>Alternately, if this is your site you could create your own error page in place of this one. See how to <b><a href="http://help.blueyonder.co.uk">on our helpsite</a></b>.</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="middle" colspan=2 align=right><img src="http://www.blueyonder.co.uk/images/pwp/by_logo.gif" width="217" height="50" alt="blueyonder logo"></td>
</tr>
<tr>
</table>
</body>
</html>
why isnt it working for me? frown

#10914 14/02/03 04:33 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Then it is not finding the file. Make sure you have your path correct or use the full http string

sockwrite -n $sockname GET http[/b]://yoursite.com/subdir/page.txt HTTP/1.0
sockwrite $sockname $crlf


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard