title: Web service for retrieving records using php xml-rpc protocol
body: <p>I am trying to implement a web service using PHP. I am following xml-rpc protocol. </p>
  
  <p>I am trying to call a function through index file and display records from the database but when i try to call the function in file server2 nothing is printed on the screen just a blank white screen is showed up here is my code so far.</p>
  
  <p>Kindly help me out with this I have spent hours searching about this but cannot find any help </p>
  
  <p>server2.php</p>
  
  <pre><code>&lt;?php
  $request_xml = file_get_contents("php://input");
  function say_hello($method_name, $args) {
  
      $dbLink = mysqli_connect('localhost','root','saad','enstructo');
      if (!$dbLink) {
      echo "ERROR";
  }
      $query = "SELECT * FROM Admin";
       if ($result = mysqli_query($dbLink,$query)) {
           while($getquery = mysql_fetch_array($result)){
              $returnquery[] =array($result['username'],$result['email']) ;
          }
       }
      return $returnquery;
  }
  
  $xmlrpc_server = xmlrpc_server_create();
  xmlrpc_server_register_method($xmlrpc_server, "say_hello", "say_hello");
  header('Content-Type: text/xml');
  print xmlrpc_server_call_method($xmlrpc_server, $request_xml, array());
  ?&gt;
  </code></pre>
  
  <p>index.php</p>
  
  <pre><code>&lt;?php 
  $request = xmlrpc_encode_request("say_hello", array('10'));
  $context = stream_context_create(array('http' =&gt; array(
      'method' =&gt; "POST",
      'header' =&gt; "Content-Type: text/xml\r\nUser-Agent: PHPRPC/1.0\r\n",
      'content' =&gt; $request
  )));
  $server = 'http://localhost/rpc/basic/server2.php';
  $file = file_get_contents($server, false, $context);
  $response = xmlrpc_decode($file);
  echo $response;
  ?&gt;
  </code></pre>