mIRC Home    About    Download    Register    News    Help

Print Thread
#248478 09/10/14 02:23 PM
E
Exuviax
Exuviax
E
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.

#248479 09/10/14 02:41 PM
B
Belhifet
Belhifet
B
Nillen's script for this works just fine.

#248481 09/10/14 02:57 PM
Joined: Dec 2013
Posts: 771
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 771
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
}

Nillen #248482 09/10/14 02:59 PM
E
Exuviax
Exuviax
E
Oh awesome! thanks so much, I guess the post I found for this was outdated. Thanks Nillen.

Nillen #248484 09/10/14 03:55 PM
P
patrickplays
patrickplays
P
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.
#248485 09/10/14 05:21 PM
Joined: Dec 2013
Posts: 771
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 771
Untested
Code:
msg %target has been online for $iif(hours isin $1-,$1 hours and $3-,$1-)


Link Copied to Clipboard