aldinokemal/go-whatsapp-web-multidevice

Send messages via PHP

Closed this issue · 2 comments

Hello,

I have already running at 3000 port in my server. I want to send messages via PHP. But I can't find a way. I hope it can do by POST method or something.

Thank You.

you can use Guzzle Http

<?php
$client = new Client();
$headers = [
  'Authorization' => 'Basic a2VtYWw6MjEwNA=='
];
$options = [
  'multipart' => [
    [
      'name' => 'phone',
      'contents' => '6283866237125-1365595428'
    ],
    [
      'name' => 'file',
      'contents' => Utils::tryFopen('/Users/aldinokemal/Pictures/bbkkp.png', 'r'),
      'filename' => '/Users/aldinokemal/Pictures/bbkkp.png',
      'headers'  => [
        'Content-Type' => '<Content-type header>'
      ]
    ],
    [
      'name' => 'caption',
      'contents' => ''
    ]
]];
$request = new Request('POST', '{{HOSTNAME}}/send/file', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();

Thank you very much, i will try this now