Contoh Kirim Pesan Whatspie PHP

Kirim Pesan Biasa

<?php

$curl = curl_init();

$pesan = urlencode("selamat pagi in test
saja ua okee
1
2
3
4
 ") ;


curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://app.whatspie.com/api/messages',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => 'receiver=6285284606999&device=085284606999&message='.$pesan.'&type=chat',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Content-Type: application/x-www-form-urlencoded',
    'Authorization: Bearer 9bvlNttYEffsafsafsafsfsafasfsfsafsafs'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Kirim Pesan Dengan Gambar

<?php

$curl = curl_init();

$pesan = urlencode("selamat pagi in test
saja ua ")

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://app.whatspie.com/api/messages',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => 'receiver=6285284606999&device=085284606999&message=Image%20caption%20here&type=image&file_name=cool.png&file_url=https://png.pngtree.com/png-clipart/20200310/ourmid/pngtree-indonesia-flag-transparent-watercolor-painted-brush-png-image_2156710.jpg',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Content-Type: application/x-www-form-urlencoded',
    'Authorization: Bearer 9BdsadsadULrtMN4GeHlh8sYzZx4csdsadXMwedsaRC3cxeNDV'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

 2,520 total views

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *