0
function httpPost( $url, $data )
{
 $curl = curl_init( $url );
 curl_setopt( $curl, CURLOPT_POST, true );
 curl_setopt( $curl, CURLOPT_POSTFIELDS, $data );
 curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
 $headers =  array(
   'X-Algolia-Application-Id: '.AL_APP_ID,
   'X-Algolia-API-Key: '.AL_APP_KEY
);
 curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
doDebug('curl-headers',$headers);
 $response = curl_exec( $curl );
 curl_close( $curl );
 return $response;
 }

I am using the code above to try and access the Places using the following URL https://places-dsn.algolia.net/1/places/query

Which works fine unless I try and authenticate with the Application ID (plSIJRKTUUU7) and Search Key from my account at which point I get

Invalid Application-ID or API key

I suspect I am missing something obvious on the documentation and I am very new to algolia.

Documentation I am using is here https://community.algolia.com/places/rest.html

Jane T
  • 2,081
  • 2
  • 17
  • 23

1 Answers1

0

This question was also asked and answered here: https://discourse.algolia.com/t/places-authenticate-using-php-and-curl/1314

Julien Bourdeau
  • 1,193
  • 11
  • 17