Update a form with PHP

Thanks to Navin for this code snippet.

Use it for updating an existing form's JSON from PHP.

$url = "https://www.devicemagic.com/organizations/XXXX/forms/XXXXX"; 
$curl = curl_init($url); 
$headers=array('Authorization: Basic '. 
base64_encode('XXXXXX:YYYY'),'Content-Type: application/json'); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); 
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);


Have more questions? Submit a request


  • Avatar

    Pretty incomplete (and confusing) example! Reference is made to $data in POSTFIELDS, but no indication as to what that actually contains.

    Also, the base64_encode has a parameter of 'XXXXXX:YYYY' - what's that all about?

    Would be more helpful if it contained the php structure as well - and some notes to explain what is what. This is, after all, supposed to be a HELP article!

  • Avatar

    I agree with the Comment above: A Little more context would be very useful!


Powered by Zendesk