title: sending a nexmo sms to all numbers stored in the database with laravel
body: <p>hi everyone I have a problem with my code I try to send a nexmo text to all the numbers in my database. When sending I have this error in my browser "Array to string conversion" and the error shows this line "  CURLOPT_POSTFIELDS => $postData "if someone can help me."</p>
  
  <p>I tried to do a dd (' $ message ') and dd (' $ options') I get the values of my fields well but when sending I always have the same error. I tried to see the method implode () but no success.</p>
  
  <pre><code>    public function sendMsg(Request $request)
      {
          $message = $request-&gt;input('message');
          $options = $request-&gt;input('telephone');
          $encodeMessage = urlencode($message);
  
  
          $authkey = '********'; 
          $senderId = '******************';
          $route = 4;
          $postData = $request-&gt;all();
  
          $mobileNumber = implode(" ", $postData['telephone']);
  
          $arr = str_split($mobileNumber, '12');
          $mobiles = implode(", ", $arr);
  
          $data = array(
          'authkey' =&gt; $authkey,
          'mobiles' =&gt; $mobiles,
          'message' =&gt; $encodeMessage,
          'sender' =&gt; $senderId,
          'route' =&gt; $route
          );
  
          $url = "https://rest.nexmo.com/sms/json";
          $ch = curl_init();
          curl_setopt_array($ch, array(
          CURLOPT_URL =&gt; $url,
          CURLOPT_RETURNTRANSFER =&gt; true,
          CURLOPT_POST =&gt; true,
          CURLOPT_POSTFIELDS =&gt; $postData
          ));
  
          curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
          curl_setopt($ch, CURLOPT_SSL_VERIFYpeer, 0);
  
          $output = curl_exec($ch);
  
          if (curl_errno($ch)) {
          echo 'error:' . curl_errno($ch);
          }
          curl_close($ch);
          return redirect('/create');
      }
  </code></pre>