是我的授权码。但它不适用于我。我必须发送帖子参数和授权标题。
我的价值观是:
URL:
http://202.65.147.152:8080/tgtdc/etgweb/hotels.jsp
Header Parameters:
ETG-WEB-HEADER = "BzgYn6pXsdYk7nm67CGfjn6L3sY="
Request/POST Parameters:
USER = "etgweb"
KEY = "489j-fjof"
TOKEN = "BzgYn6pXsdYk7nm67CGfjn6L3sY="
我的代码是:
$curl = curl_init( 'http://202.65.147.152:8080/tgtdc/etgweb/hotels.jsp' );
$data=array(
'USER' => 'etgweb',
'KEY' => '489j-fjof',
'TOKEN' => 'BzgYn6pXsdYk7nm67CGfjn6L3sY=',
);
$header = array();
$header[] = 'Content-length: 0';
$header[] = 'Content-type: application/json';
$header[] = 'Authorization: BzgYn6pXsdYk7nm67CGfjn6L3sY=';
$header[] = 'Accept: application/json';
$header[] = 'Content-length: 0';
$data_string = json_encode($data);
curl_setopt( $curl, CURLOPT_POST, true );
curl_setopt($curl, CURLOPT_HTTPHEADER,$header);
curl_setopt( $curl, CURLOPT_POSTFIELDS,$data);
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1);
$auth = curl_exec( $curl );
$auth = json_decode($auth);
print_r(curl_exec( $curl ));
任何正文都可以帮助我如何设置授权以获取Web服务值。提前谢谢。