# How we send data to api from PHP?

**URL:** <https://devforum.zoom.us/t/how-we-send-data-to-api-from-php/913>\
**Category:** API and Webhooks\
**Created:** [January 24, 2018, 4:48am UTC](https://devforum.zoom.us/t/how-we-send-data-to-api-from-php/913 "2018-01-24T04:48:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![InstructUs\_Online\_Su](https://avatars.discourse-cdn.com/v4/letter/i/ed8c4c/32.png) [@InstructUs\_Online\_Su](https://devforum.zoom.us/u/InstructUs_Online_Su)\
**Post date:** [January 24, 2018, 4:48am UTC](https://devforum.zoom.us/t/how-we-send-data-to-api-from-php/913/1 "2018-01-24T04:48:13Z")

</div>

Hi I&nbsp;am trying to&nbsp;add a webinar registrant from API but it’s not accepting data and return

stdClass Object ( [code] =\> 300 [message] =\> Unsupported Content Type )

THIS CODE IS RUNNING IN PHP

function addWebinarReg($webinarID, $email, $firstName, $lastName) {  
$regData = array(  
“email” =\> $email,  
“first\_name” =\> $firstName,  
“last\_name” =\> $lastName  
);

$jsonStrReg = json\_encode($regData);  
$httpStrReg = http\_build\_query($regData);

$ch = curl\_init(‘[https://api.zoom.us/v2/webinars/’.$webinarID.’/registrants](https://api.zoom.us/v2/webinars/'.%24webinarID.'/registrants)’);  
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);

curl\_setopt($ch, CURLOPT\_POST, true);  
curl\_setopt($ch, CURLOPT\_POSTFIELDS, $httpStrReg);

curl\_setopt($ch, CURLOPT\_HTTPHEADER, array(  
'Authorization: Bearer ’ . generateJWT()  
));

$response = curl\_exec($ch);  
$response = json\_decode($response);  
curl\_close($ch);  
return $response;  
}

What are the way to send data to body FROM PHP?

---

<div class="post-metadata">

**Author:** ![Dean\_Si](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dean_si/32/764_2.png) [@Dean\_Si](https://devforum.zoom.us/u/Dean_Si)\
**Post date:** [January 24, 2018, 7:01am UTC](https://devforum.zoom.us/t/how-we-send-data-to-api-from-php/913/2 "2018-01-24T07:01:03Z")

</div>

You can refer to&nbsp;[https://zoom.github.io/api/#add-a-webinar-registrant](https://zoom.github.io/api/#add-a-webinar-registrant)&nbsp; and check body arguments with JSON format

---

<div class="post-metadata">

**Author:** ![Joshua\_Woodward1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/joshua_woodward1/32/1480_2.png) [@Joshua\_Woodward1](https://devforum.zoom.us/u/Joshua_Woodward1)\
**Post date:** [January 24, 2018, 8:48pm UTC](https://devforum.zoom.us/t/how-we-send-data-to-api-from-php/913/3 "2018-01-24T20:48:20Z")

</div>

curl\_setopt($ch, CURLOPT\_HTTPHEADER, array(  
'Authorization: Bearer ’ . generateJWT(),

“Content-Type: application/json”&nbsp;  
));

&nbsp;

From the error message, try adding the content type that you are passing.

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 5:36pm UTC](https://devforum.zoom.us/t/how-we-send-data-to-api-from-php/913/4 "2020-08-21T17:36:21Z")

</div>

Closed on August 21, 2020, 5:36pm UTC


