PHP Request Header Menggunakan Postman
A. Impelement request header to get response JSON or XML based on Content-Type that client request 1. Buat folder didalam folder htdocs dengan nama php-request-header. 2. Buat file php dengan nama content-type-header.php simpan dalam folder php-request-header, isinya sebagai berikut : <?php if ( $_SERVER [ 'CONTENT_TYPE' ] == 'application/json' ){ echo "Content-Type = application/json" ; } elseif ( $_SERVER [ 'CONTENT_TYPE' ] == 'application/xml' ){ echo "Content-Type = application/xml" ; } else { echo "Content-Type is not valid" ; } ? > 3. Buka postman, setting sebagai berikut : 1. Pilih method GET 2. isi url dengan localhost/perkuliahan/php-request-header/content-type-header.php 3. Tab Header isi key = Content-Type , Value = application/json 4. Klik Send Maka Hasilnya seperti gambar dibawah ini : Catata...