<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Use of undefined constant CURLAUTH_BEARER - assumed 'CURLAUTH_BEARER' in Discussion Forum</title>
    <link>https://community.sinch.com/t5/Discussion-Forum/Use-of-undefined-constant-CURLAUTH-BEARER-assumed-CURLAUTH/m-p/10979#M105</link>
    <description>&lt;P&gt;Hi Sam&lt;/P&gt;&lt;P&gt;I'm using cURL 7.83.1&lt;/P&gt;</description>
    <pubDate>Mon, 06 Feb 2023 16:42:03 GMT</pubDate>
    <dc:creator>Ts01</dc:creator>
    <dc:date>2023-02-06T16:42:03Z</dc:date>
    <item>
      <title>Use of undefined constant CURLAUTH_BEARER - assumed 'CURLAUTH_BEARER'</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/Use-of-undefined-constant-CURLAUTH-BEARER-assumed-CURLAUTH/m-p/10977#M103</link>
      <description>&lt;P&gt;I have copied the PHP code from your website and whenever I run it, I get the the error :-&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;"Use of undefined constant CURLAUTH_BEARER - assumed 'CURLAUTH_BEARER'&lt;/FONT&gt;", here is the code here below please help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;?php&lt;BR /&gt;$service_plan_id = "acbb90139d844ac985e72d7760xxxxxx"; //ServiceplanID&lt;BR /&gt;$bearer_token ="-Uri &lt;A href="https://sms.api.sinch.com/xms/v1/acbb90139d844ac985e72d7760xxxxxx/batches" target="_blank" rel="noopener"&gt;https://sms.api.sinch.com/xms/v1/acbb90139d844ac985e72d7760xxxxxx/batches&lt;/A&gt;";&lt;/P&gt;
&lt;P&gt;//Any phone number assigned to your API&lt;BR /&gt;$send_from = "447537404817";&lt;BR /&gt;//May be several, separate with a comma ,&lt;BR /&gt;$recipient_phone_numbers = "+277202xxxx";&lt;BR /&gt;$message = "Test message to {$recipient_phone_numbers} from {$send_from}";&lt;/P&gt;
&lt;P&gt;// Check recipient_phone_numbers for multiple numbers and make it an array.&lt;BR /&gt;if(stristr($recipient_phone_numbers, ',')){&lt;BR /&gt;$recipient_phone_numbers = explode(',', $recipient_phone_numbers);&lt;BR /&gt;}else{&lt;BR /&gt;$recipient_phone_numbers = [$recipient_phone_numbers];&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;// Set necessary fields to be JSON encoded&lt;BR /&gt;$content = [&lt;BR /&gt;'to' =&amp;gt; array_values($recipient_phone_numbers),&lt;BR /&gt;'from' =&amp;gt; $send_from,&lt;BR /&gt;'body' =&amp;gt; $message&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;$data = json_encode($content);&lt;/P&gt;
&lt;P&gt;$ch = curl_init("&lt;A href="https://us.sms.api.sinch.com/xms/v1/{$service_plan_id}/batches" target="_blank" rel="noopener"&gt;https://us.sms.api.sinch.com/xms/v1/{$service_plan_id}/batches&lt;/A&gt;");&lt;BR /&gt;curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));&lt;BR /&gt;curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BEARER);&lt;BR /&gt;curl_setopt($ch, CURLOPT_XOAUTH2_BEARER, $bearer_token);&lt;BR /&gt;curl_setopt($ch, CURLOPT_POST, true);&lt;BR /&gt;curl_setopt($ch, CURLOPT_POSTFIELDS, $data);&lt;BR /&gt;curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);&lt;BR /&gt;curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);&lt;/P&gt;
&lt;P&gt;$result = curl_exec($ch);&lt;/P&gt;
&lt;P&gt;if(curl_errno($ch)) {&lt;BR /&gt;echo "Curl error: " . curl_error($ch);&lt;BR /&gt;} else {&lt;BR /&gt;echo $result;&lt;BR /&gt;}&lt;BR /&gt;curl_close($ch);&lt;BR /&gt;}&lt;BR /&gt;?&amp;gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 11:51:27 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/Use-of-undefined-constant-CURLAUTH-BEARER-assumed-CURLAUTH/m-p/10977#M103</guid>
      <dc:creator>Ts01</dc:creator>
      <dc:date>2023-03-16T11:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Use of undefined constant CURLAUTH_BEARER - assumed 'CURLAUTH_BEARER'</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/Use-of-undefined-constant-CURLAUTH-BEARER-assumed-CURLAUTH/m-p/10978#M104</link>
      <description>&lt;P&gt;Hello, thank you for reaching out! &lt;BR /&gt;&lt;BR /&gt;Can you let us know which versions of PHP/cURL you have installed? The &lt;STRONG&gt;CURLAUTH_BEARER&lt;/STRONG&gt; constant has been &lt;A title="cURL constants" href="https://www.php.net/manual/en/curl.constants.php" target="_blank" rel="noopener"&gt;available since PHP 7.3.0 and cURL 7.61.0&lt;/A&gt;, so you may be running into issues if you are using a prior version of either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 15:43:43 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/Use-of-undefined-constant-CURLAUTH-BEARER-assumed-CURLAUTH/m-p/10978#M104</guid>
      <dc:creator>Sam_Williams</dc:creator>
      <dc:date>2023-02-06T15:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Use of undefined constant CURLAUTH_BEARER - assumed 'CURLAUTH_BEARER'</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/Use-of-undefined-constant-CURLAUTH-BEARER-assumed-CURLAUTH/m-p/10979#M105</link>
      <description>&lt;P&gt;Hi Sam&lt;/P&gt;&lt;P&gt;I'm using cURL 7.83.1&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 16:42:03 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/Use-of-undefined-constant-CURLAUTH-BEARER-assumed-CURLAUTH/m-p/10979#M105</guid>
      <dc:creator>Ts01</dc:creator>
      <dc:date>2023-02-06T16:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Use of undefined constant CURLAUTH_BEARER - assumed 'CURLAUTH_BEARER'</title>
      <link>https://community.sinch.com/t5/Discussion-Forum/Use-of-undefined-constant-CURLAUTH-BEARER-assumed-CURLAUTH/m-p/10980#M106</link>
      <description>&lt;P&gt;Hello again!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your response. I've reached out to someone on our SMS team to see if they can provide any more insight into this issue. In the meantime, you can try to use the code sample provided in our &lt;A title="API reference" href="https://developers.sinch.com/docs/sms/api-reference/sms/tag/Batches/#tag/Batches/operation/SendSMS" target="_blank" rel="noopener"&gt;API reference&lt;/A&gt;&amp;nbsp;(you can set the language to &lt;STRONG&gt;PHP&lt;/STRONG&gt; using the drop-down list above the code sample). That sample makes use of the &lt;STRONG&gt;libcurl&lt;/STRONG&gt; library, and does not reference the &lt;STRONG&gt;CURLAUTH_BEARER&lt;/STRONG&gt; constant. Finally, do you know which version of PHP you are using? That may also be contributing to your issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 17:06:24 GMT</pubDate>
      <guid>https://community.sinch.com/t5/Discussion-Forum/Use-of-undefined-constant-CURLAUTH-BEARER-assumed-CURLAUTH/m-p/10980#M106</guid>
      <dc:creator>Sam_Williams</dc:creator>
      <dc:date>2023-02-06T17:06:24Z</dc:date>
    </item>
  </channel>
</rss>

