mIRC Homepage

Reading from URL

Posted By: Exuviax

Reading from URL - 09/10/14 02:23 PM


So I am looking for a way to read from a URL that only has one line of text on it. I am not good at SoccetRead at all, and have read so much and just can't get anything to work.

This is the URL I am trying to get to http://nightdev.com/hosted/uptime.php?channel=ifstudios

Somewhere on here someone has asked this question to this URL, I read through it and it didn't work. It always says that the channel isn't live.
Posted By: Belhifet

Re: Reading from URL - 09/10/14 02:41 PM

Nillen's script for this works just fine.
Posted By: Nillen

Re: Reading from URL - 09/10/14 02:57 PM

on *:text:!uptime*:#:{
  set %target $iif($2,$2,$mid(#,2-))
  set %channel #

alias uptime {
  sockclose uptime
  sockopen uptime nightdev.com 80

on *:sockopen:uptime:{
  if ($sockerr) { sockclose $sockname | halt }
  sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ %target HTTP/1.1
  sockwrite -n $sockname Host: www.nightdev.com 
  sockwrite -n $sockname $crlf

on *:sockread:uptime:{
  if ($sockerr) { sockclose $sockname | halt }
  var %data
  sockread %data
  tokenize 32 %data
  if ($1 isnum) && ($2) { msg %channel %target has been online for $1- }
  elseif (%data == The channel is not live.) msg %channel %target is currently not online.

on *:sockclose:uptime:{ 
  unset %channel
  unset %target
Posted By: Exuviax

Re: Reading from URL - 09/10/14 02:59 PM

Oh awesome! thanks so much, I guess the post I found for this was outdated. Thanks Nillen.
Posted By: patrickplays

Re: Reading from URL - 09/10/14 03:55 PM

since the nightdev site is giving out 2 hours, 57 minutes
how would i go and split those two into their own variables?
$gettok($1-,1,44) and $gettok($1-,2,44)
? smile

basicall i want to say "has been online for 2 hours and 27 minutes.
i dislike 2 hours, 27 minutes
Posted By: Nillen

Re: Reading from URL - 09/10/14 05:21 PM

msg %target has been online for $iif(hours isin $1-,$1 hours and $3-,$1-)
© 2022 mIRC Discussion Forums