Error Code 50/ Http_status_code 401 : Must supply a valid HTTP Basic..


I am currently trying to pull data from a campaign monitor list.

Here is the php code :
require_once 'campaignmonitor/csrest_lists.php';

$wrap = new CS_REST_Lists($apiKey, $listID);

$result = $wrap->get_active_subscribers(date('Y-m-d', strtotime('-700 days')), 1, 1000, 'email', 'asc');

Then, I have the following error code :

[code]CS_REST_Wrapper_Result Object ( [response] => stdClass Object ( [code] => 50 [Message] => Must supply a valid HTTP Basic Authorization header ) [http_status_code] => 401 )[/code]

I checked 3 times the value of the $apiKey and the $listID parameter.
What am I doing wrong?

Thanks in advance!

Phil Phil, 5 years ago

Hi theobdev,

Check the signature of the CS_REST_Lists constructor, and the way it's used in the sample

If you reverse the order of $apiKey and $listID you'll be fine :)

theobdev, 5 years ago

Thank you Phil, it is now working.

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free