I have added several custom fields to leads and want to populate those in a web form. I can see that the php array is populated with all the correct values, and whilst the lead gets created and I get a 201 status code, none of the custom fields are set.

Make sure that you pass a custom field's code correctly. It should look the following way: UF_CRM_<unique_code>. You can find this code at the URL of the required field editing form, e.g. https://<you_bitrix24_name>.bitrix24.com/crm/configs/fields/CRM_LEAD/edit/UF_CRM_1351087512/

// CRM server authorization data//define('CRM_LOGIN', 'userid'); login of a CRM user able to manage leads////define('CRM_PASSWORD', 'password'); password of a CRM user//// OR you can send special authorization hash which is sent by server after first successful connection with login and passworddefine('CRM_AUTH', 'Your Auth Code Here'); // authorization hash

<label for="Request Demo">Request Demo</label><select name="DATA[Request Demo]" title="If you would like a product demo, please select Yes and if appropriate type your requirements in the Comments and Questions field"><option value="No">No</option><option value="Yes">Yes</option></select><br>

<label for="Request Trial">Request Trial</label><select name="DATA[Request Trial]" title="If you would like to trial the software, please select Yes and if appropriate type your requirements in the Comments and Questions field"><option value="No">No</option><option value="Yes">Yes</option></select><br>

<label for="Request More Information">Request More Information</label><select name="DATA[Request More Information]" title="If you would like more information, please select Yes and if appropriate type your requirements in the Comments and Questions field"><option value="No">No</option><option value="Yes">Yes</option></select><br>

I have added several custom fields to leads and want to populate those in a web form. The last is the product to be attached to the lead. I can see that the php array is populated with all the correct values, and whilst the lead gets created and I get a 201 status code, none of the product fields are set.