API Test
";
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $url);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
$info = curl_getinfo($ch);
if($_POST[returntype] == "json"){
if($info['http_code'] == 202){
echo $output;
}else{
$output= json_decode($output);
echo json_encode($output, JSON_PRETTY_PRINT);
}
}else{
$xml = new SimpleXMLElement($output);
echo htmlspecialchars($xml->asXML());
}
// close curl resource to free up system resources
curl_close($ch);
}
/*$simple = file_get_contents("../generated.wsdl");
$p = xml_parser_create();
xml_parse_into_struct($p, $simple, $vals, $index);
xml_parser_free($p);
echo "Index array\n";
print_r($index);
// echo "\nVals array\n";
// print_r($vals);
// die;
$calls = array();
foreach($vals as $key=>$val){
if($val[type] == 'open' && $val[level] == 3 && $val[tag] == "WSDL:OPERATION" && $vals[$key-1][tag] != "WSDL:PORTTYPE"){
var_dump($key);
var_dump($val);
echo "================";
}
if($val[type] == 'open' && $val[level] == 3 && $val[tag] == "WSDL:OPERATION" && $vals[$key-1][tag] != "WSDL:BINDING"){
var_dump($key);
var_dump($val);
echo "+===============";
}
}
die;*/
?>