@@ -255,9 +255,7 @@ public static function generateQuery($query = array())
255255 * */
256256 public static function generateQueryParams ($ query = array ())
257257 {
258- $ QueryParams = Utility::generateQuery ($ query );
259- $ Headers = Utility::headers ($ query );
260- $ result = array_merge ($ QueryParams , $ Headers );
258+ $ result = Utility::generateQuery ($ query );
261259 return http_build_query ($ result );
262260 }
263261
@@ -370,14 +368,22 @@ public static function contentstackRequest($queryObject = '', $type = '')
370368 if ($ queryObject ) {
371369 $ http = curl_init (Utility::contentstackUrl ($ queryObject , $ type ));
372370
373- // setting the GET request
371+ // setting the HTTP Headers
372+ $ Headers = Utility::headers ($ queryObject );
373+
374+ $ request_headers = array ();
375+ $ request_headers [] = 'x-user-agent: contentstack-php/1.6.1 ' ;
376+ $ request_headers [] = 'api_key: ' .$ Headers ["api_key " ];
377+ $ request_headers [] = 'access_token: ' .$ Headers ["access_token " ];
378+ curl_setopt ($ http , CURLOPT_HTTPHEADER , $ request_headers );
379+
374380 curl_setopt ($ http , CURLOPT_HEADER , false );
375381 // setting the GET request
376382 curl_setopt ($ http , CURLOPT_CUSTOMREQUEST , "GET " );
377383 // receive server response ...
378384 curl_setopt ($ http , CURLOPT_RETURNTRANSFER , true );
379385 $ response = curl_exec ($ http );
380-
386+
381387 // status code extraction
382388 $ httpcode = curl_getinfo ($ http , CURLINFO_HTTP_CODE );
383389
0 commit comments