I have an enquiry form on my website which submits to some php script. How can I use CM's api so that if the user clicks 'subscribe me' checkbox on the enquiry form, their details get added to the subscriber list?
Ive donwlaoded the php api wrapper, got my api key number and list number, but whatever sample code I can find in the wrapper just returns the error "Fatal error: No transport is available"!?
Can anyone show me this very simple code?
It sounds like the error you are receiving may be to do with your PHP environment, but it is impossible to tell if you cannot identify exactly which line in your code is causing the error. It would help if you could debug your code and identify where the error is occurring.
Assuming you are using the PHP client library, you need to so something similar to the following, using the values you collect in your subscribe form:
require_once '../../csrest_subscribers.php'; $wrap = new CS_REST_Subscribers('Your list ID', 'Your API Key'); $result = $wrap->add(array( 'EmailAddress' => 'firstname.lastname@example.org', 'Name' => 'Example Subscriber', 'CustomFields' => array(), 'Resubscribe' => true ));
This answer helped me out a lot. Thanks!