http with php
#1

Hi,

I i'am using http to call to php file, there i want to load something, like 10 last killer names, and send again to my callback. I don't know how to make answer, i know need use echo, but if there 10 names, how to echo that? and how in callback get it values.
Reply
#2

You could use JSON.
Reply
#3

Like OsteeN said, you could use JSON. I made small script for you. This is how your php file could look like if you use JSON.

PHP код:
<table width="500">
    <tr>
        <td> Killer </td>
        <td> Weapon </td>
        <td> Player </td>
    </tr>
<?php
    $i 
0;
    
$json json_decode(file_get_contents("JSON URL"));
    foreach(
$json->kills as $data)
    {
        if (
$i++ == 10) break;
        echo 
"<tr>";
            echo 
"<td>".$data->killer."</td>";
            echo 
"<td>".$data->weapon."</td>";
            echo 
"<td>".$data->player."</td>";
        echo 
"</tr>";
    }
?>
</table>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)