Error while creating Hosted Page for New Subscription via Hosted Page API
Hi Team,
I get a
HTTP request failed! HTTP/1.1 400 Bad Request error while trying to create a hosted page for new subscription using Hosted Page API
Here's my code:
- $data = array(
- 'customer'=>array('display name'=>'Mr. Hash Tiwari','first_name'=>'Tarun','last_name'=>'Tiwari','email'=>"tarun@noemail.com",'mobile'=>'99999999999'),
- 'plan'=>array('plan_code'=>'Small'),
- 'custom_fields'=>array('variant'=>'Chicken'),
- 'reference_id'=>'2222222'
- );
- $data = json_encode($data);
- $context = array(
- 'http'=>array(
- 'method'=>"POST",
- 'header'=>"Content-Type: application/json;charset=UTF-8\r\n" .
- "Content-Length: ".strlen($data)."\r\n".
- "X-com-zoho-subscriptions-organizationid: 639344623\r\n" .
- "Authorization: Zoho-authtoken xxxxxxxxxxxxxxxxxxxxxxxxx\r\n",
- 'content'=>$data
- )
- );
- $context = stream_context_create($context);
- // Open the file using the HTTP headers set above
- $file = file_get_contents("https://subscriptions.zoho.com/api/v1/hostedpages/newsubscription", false, $context);
- echo $file;