return $text; } //returns an error sentence if the ratio of punctuation characters to alphanumeric characters is >4 function punct($text) { $numAlpha = 0; preg_match_all("/\\w/", $text, $numAlpha); $numPunct = 0; preg_match_all("/\\p{P}\\p{S}/", $text, $numPunct); if ((count($numAlpha[0]) + 1) / (count($numPunct[0]) + 1) < 4.0) { $text = "Too much punctuation, please try again."; } return $text; } // $data = file_get_contents("php://input"); echo $_POST['firstname']; // $data = json_decode($data, TRUE); // echo $data; // $text = sanitize($data['firstname']); // echo $text; $rpc = "http://localhost:8082"; $client = new xmlrpc_client($rpc, true); $resp = $client->call('sample.rain', array($_POST['firstname'])); echo $resp; //$jsonres = json_decode(sanitize_text($resp)); //echo json_encode($jsonres); ?> </body> </html>