0

i try to test HTTP POST my restfull web service on advanced rest client chrome, but i know i need a separate variable to input value of my variable into the payload form like this :restfull advanced web service[1] [1]: https://i.stack.imgur.com/wMYUQ.jpg but i put all variable into array this is my code : `

$dcd = json_decode (file_get_contents("php://input"),true);
    $nama_kolom = array ('user','cpu','type','manufacturer','model','serial_no','location','network_status',
            'date_purchase','purchase_order','ram','hdd','operating_system','serial_number','monitor','ups');
    $kunci= array_keys($dcd);
    $kolom='';
    $value='';

    foreach ($nama_kolom as $hasil) {
        if(!in_array($hasil, $kunci)) 
        {
            $$hasil='';
        }
        else 
        {
            $$hasil=$dcd[$hasil];
        }
        $kolom= $kolom.$hasil.',';
        $value= $value."'".$$hasil."',";
    }
    $sql= "INSERT INTO data (".trim($kolom,',').") VALUES(".trim($value,',').")";` 

So how should i do to test and input value into my variable on advanced RESTful client chrome when i do array into my variable?? this code working properly on user interface. i just do not know how to test this if i do array into variable.please help

  • I usually just use the `raw` section of the body and select `application/json` from the dropdown. Just enter in your json object as your server expects. – Ben Felda Sep 06 '14 at 03:21
  • yes of course you right, but i do not know how to describe my JSON into RAW, would you mind to show me how do it work?? if the variable like array like this $array : ('user','name') so how about that?? – user3511548 Sep 06 '14 at 03:28
  • possible duplicate of [How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?](http://stackoverflow.com/questions/7172784/how-to-post-json-data-with-curl-from-terminal-commandline-to-test-spring-rest) – meda Sep 06 '14 at 04:50
  • nope, i think isnt duplicate, different problem i think. please help – user3511548 Sep 07 '14 at 04:05

0 Answers0