mIRC Home    About    Download    Register    News    Help

Print Thread
#248478 09/10/14 02:23 PM
Joined: Mar 2014
Posts: 65
E
Exuviax Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Mar 2014
Posts: 65
Hey,

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.


I do things with stuff that makes other things do stuff.
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
Nillen's script for this works just fine.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
on *:text:!uptime*:#:{
  set %target $iif($2,$2,$mid(#,2-))
  set %channel #
  uptime 
}

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
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #248482 09/10/14 02:59 PM
Joined: Mar 2014
Posts: 65
E
Exuviax Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Mar 2014
Posts: 65
Oh awesome! thanks so much, I guess the post I found for this was outdated. Thanks Nillen.


I do things with stuff that makes other things do stuff.
Nillen #248484 09/10/14 03:55 PM
Joined: Mar 2014
Posts: 52
P
Babel fish
Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
since the nightdev site is giving out 2 hours, 57 minutes
how would i go and split those two into their own variables?
Code:
$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

Last edited by patrickplays; 09/10/14 04:01 PM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Untested
Code:
msg %target has been online for $iif(hours isin $1-,$1 hours and $3-,$1-)


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net

Link Copied to Clipboard