1

below is the my authorization code. but it is not working for me.I have to send post parameters and authorization header.

My values are:

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="

My code is:

 $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 ));

Can any body please help me how do i set authorization to get web service values. Thanks in advance.

sucharitha
  • 25
  • 10

0 Answers0