我是 php 新手,需要使用他们的 API 查询 oracle 数据库。我只能在正文中以 xml 或 json 形式发送查询。我不确定我是否做得对。请找到代码
<?php
//HTTP Headers
$header = array('Content-Type = application/xml','Accept = application/xml');
$xmlquery = <<<XML
---- query----
XML;
$body = simplexml_load_string($xmlquery);
//URL containing query parameters : appGUID, pagenumber, pagesize
$url='http://<server name>?appGUID=<GUID>&pagenumber=1&pagesize=50';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$body);
//CURLOPT_POSTFIELDS : The full data to post in a HTTP "POST" operation.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
var_dump ($response);
curl_close($ch);
?>