Unity-Technologies / qstat

New official qstat repository
Artistic License 2.0
121 stars 33 forks source link

qstat template #81

Closed Kr3m closed 6 years ago

Kr3m commented 6 years ago

qstat -xml -P -q3s 96.75.63.49:27960 works great if I need XML output. However, I'm trying to output a template instead. I've tried qstat -Ts -P -q3s 96.75.63.49:27960, but I get no such file or directory.

stevenh commented 6 years ago

-Ts expects a template argument so you need something like:

qstat -Ts mytemplate.txt -P -q3s 96.75.63.49:27960
Kr3m commented 6 years ago

Is there a way of displaying html without outputting to a file?

Kr3m commented 6 years ago

I've tried using PHP to load the XML output, but I must be doing something wrong.

<?php system("qstat -xml -P -q3s 96.75.63.49:27960"); ?> and <?php $doc = new DOMDocument(); $doc->load('./qtmp.php'); echo $doc->saveXML(); ?> output: <?xml version="1.0"?>

Kr3m commented 6 years ago

qstat -Ts q.html -P -q3s 96.75.63.49:27960 output doesn't exist. q.html is empty.

Kr3m commented 6 years ago

<?php $xml=simplexml_load_file('qtmp.php') or die("Error: Cannot create object"); print_r($xml); ?> results in an error.

stevenh commented 6 years ago

I think your missing the point of the template options. The defines the output format you want, you need to create them, its not where the output goes.

Kr3m commented 6 years ago

What's strange is using xml output, it outputs just fine if I go directly to the php file, yet for some reason, it won't load from another php file so that I can create a template that iterates over the XML. Oh well. I wish I could find a working example somewhere.

Kr3m commented 6 years ago

fixed :)

`<?php

function fileAsVar($file){ ob_start(); include($file); $msg = ob_get_contents(); ob_end_clean(); return $msg; }

$xml = simplexml_load_string(fileAsVar('qtmp.php')); print_r($xml);`