示例#1
0
 * $_POST = array(
 *      'action'=>'DoGetData'
 *      'params'=> [
 *          ...
 *      ]
 * )
 *
 */
if (!empty($_POST['action'])) {
    $result = $qas->call($_POST);
} elseif (!empty($_POST['Moniker'])) {
    // Lets step-in, refine results or get full adress details- invokes DoRefine action
    if (!empty($_POST['getDetails'])) {
        // get full address details
        $result = $qas->getAddressDetails($_POST['Moniker']);
    } else {
        // step-in / refine results
        $result = $qas->refine($_POST['Moniker']);
    }
} elseif (!empty($_POST)) {
    // Lets do initial request - invokes DoSearch action
    $test = $utils->sanitizeInputArray($_POST);
    $result = $qas->search($utils->formatSearchQuery($test));
}
if (is_a($result, 'SoapFault')) {
    //If SoapFault was returned from server
    echo $utils->soapError($result, true);
} else {
    // If everything is ok, return JSON string
    echo $qas->getJson();
}
示例#2
0
 public function testSanitizeInput()
 {
     $_POST = array('product_id' => 'libgd <?php ?>! *& ()/ \\ ^ % £', 'component' => '10', 'versions' => '2.0.33', 'testscalar' => array('2', '23', '10', '12'), 'testarray' => '2');
     $expected = array('product_id' => 'libgd ! *& ()/ \\ ^ % £', 'component' => '10', 'versions' => '2.0.33', 'testscalar' => false, 'testarray' => '2');
     $this->assertEquals($expected, $this->utils->sanitizeInputArray($_POST));
 }