ProIcons commented on a Page, JSON for MIRC  -  Sep 15, 2014

Well After Watching Farcrada's Issues, i tried to test this code my self. It failed to even return data. So i decided to make a Small Snippet in order to test your JSON Lib on both Secure and Non Secure sites.
I'm Running on Windows 7 Ultimate 64 Bit with OpenSSL Installed. The Code and Results are the following:
Image

alias Start_Json {
  set %szGlob 0
  echo -a Running JSON Lib. $time(HH:nn:ss mm/dd/yyyy)
  echo -a mIRC Version: $version
  echo -a OS Version: $os
  if ($sslready) {
    echo -a SSLReady:3 $sslready
  }
  else {
    echo -a SSLReady:4 Failed
  }
  set %szUs https://api.twitch.tv/kraken/streams/lcs_pros_in_koreansoloq
  set %szUn http://ipinfo.io/8.8.8.8/json
  echo -a Test Sites:
  echo -a - Secure Site: %szUs
  echo -a - Insecure Site: %szUn

  sockopen -e szCTestUS $gettok(%szUs,2,47) 443
  sockopen szCTestUN $gettok(%szUn,2,47) 80
}

on *:sockopen:szCTest*:{
  if (!$sockerr) {
    signal szCTest $true $sock($sockname).addr
  }
  else { signal szCTest $false $sock($sockname).addr }
  sockclose $sockname
}

on *:signal:szCTest:{ 
  if ($1 == $true) { inc %szGlob }
  else { unset %szGlob | echo -a Test Failed: | echo -a - Error: while connecting to $2 }
  if (%szGlob == 2) { echo -a Sites Online Procceeding | unset %szGlob | Run_Json }
}

alias Run_Json {
  var %jHandlerUs jH1
  var %jHandlerUn jH2
  var %szFail
  echo -a Opening Connectiong to %szUs with JSONOpen 
  JSONOpen -u %jHandlerUs %szUs

  if (!%JSONError && $json(%jHandlerUs, stream, game)) {
    echo -a Success: $v1
  }
  else {
    echo -a Failed: %JSONError
    inc %szFail
  }
  echo -a Closing JSONHandler: %jHandlerUs
  JSONClose %jHandlerUs

  echo -a Opening Connectiong to %szUn with JSONOpen 
  JSONOpen -u %jHandlerUn %szUn

  if (!%JSONError && $json(%jHandlerUn, ip)) {
    echo -a Success: $v1
  }
  else {
    echo -a Failed: %JSONError
    inc %szFail
  }
  echo -a Closing JSONHandler: %jHandlerUn
  JSONClose %jHandlerUn

  echo -a Test Complete
  echo -a Errors Occured: $iif(%szFail,$v1,None)

}
Farcrada  -  Sep 15, 2014

I do need to add to this that there's a consistant problem with Twitch's API. And that is that it can sometimes bug itself to giving nothing in return. But... Then it should fill-in $json().error(text)... Which is clearly not happening. xD

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.