Getting to grips with the API


Fairly new to the API and having NO JOY at getting it to work.

I've copied the PHP code to a local page, changed the API key and run it.
Trying to create a client using the clientCreate API.

I get the following error:

Warning: fopen( [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in ...\php\CMBase.php on line 258

Array ( )

Do I need to wrap the php in something.
Does anyone have a basic complete page showing how to get started with the API ?

JCook, 7 years ago

Is the directive 'allow_url_fopen' enabled in your php.ini file? It looks like the supplied PHP code is trying to use the HTTP stream wrapper to create an HTTP request, and that is failing due to the 'allow_url_fopen' directive being disabled. The other thing to check for is if cURL support is enabled in your PHP installation. I think the code supplied uses cURL in preference to the HTTP stream wrapper if it is enabled. Have a look at phpinfo() to see what is enabled.

Join 150,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free