Advertisement
fazeela

d

Mar 23rd, 2013
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2. $locn=$_SESSION['location'];
  3.  //echo $locn;
  4. $subcategory=array(
  5. 'location'=> "$locn");
  6. //echo json_encode($subcategory);//coverting the vlaues collected from form into json
  7. //calling the web service
  8.  $url='http://192.168.2.21:8080/WisManOnlineCenter_1.0/services/trial/getHostSubcategory';
  9.  $data=$subcategory;
  10.      echo("Input to Server : ".$data."\n");
  11.         $ch=curl_init();
  12.         curl_setopt($ch, CURLOPT_URL, $url);
  13.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  14.         curl_setopt($ch, CURLOPT_POST, true);
  15.         curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($subcategory));
  16.         curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
  17.         $response=  curl_exec($ch);
  18.         echo('\n'."Server response : \n \n".$response);
  19.         curl_close($ch);
  20.         //parsing the json response from server
  21.        
  22.         ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement