Browse Source

add basta de testes

websocket
lucascardo12 3 years ago
parent
commit
334f02d55c
  1. 3
      .gitignore
  2. 36
      tests/teste.php
  3. 37
      tests/teste2.php

3
.gitignore vendored

@ -17,4 +17,5 @@ yarn-error.log
/public/node_modules
/public/vendor
/banco
/websocket/vendor
/websocket/vendor
composer.lock

36
tests/teste.php

@ -0,0 +1,36 @@
<?php
include dirname(__DIR__) . '\includes\config.php';
require dirname(__DIR__) . '\vendor\autoload.php';
use app\Providers\RequestURL;
$request = new RequestURL();
$varre = file_get_contents("C:\Users\Desenvolvimento03\Downloads\WhatsApp Ptt 2021-12-01 at 13.42.23.ogg");
$url = 'http://192.168.115.65:8081/api/enviaMsg';
$data = ["event" => [
"type" =>
"mensagem", "contact" => [
"name" => "Lucas",
"number" => "1040",
"matricula" => ""
],
"mensagem" => [
"type" => "audio",
"content" => base64_encode($varre),
"id_provedor" => '6545243524333',
"dst" => "556596107663",
"uniqueid" => 1638196372,
"media" => "whatsapp",
"datetime" => 1638196372,
"status" => "sent",
"mimetype" => "audio/ogg"
]
]];
$request->setUrl($url);
$header = array();
$header[] = 'Content-Type: application/json';
$request->post_field(json_encode($data), true);
$request->header($header);
$request->method_request("POST");
$response = $request->exec_request();
// echo base64_encode($varre);

37
tests/teste2.php

@ -0,0 +1,37 @@
<?php
include dirname(__DIR__) . '\includes\config.php';
require dirname(__DIR__) . '\vendor\autoload.php';
use app\Providers\RequestURL;
$request = new RequestURL();
$varre = file_get_contents("C:\Users\Desenvolvimento03\Downloads\Bruno_c_moreira.pdf");
$url = 'http://192.168.115.65:8081/api/enviaMsg';
$data = ["event" => [
"type" =>
"mensagem", "contact" => [
"name" => "Lucas",
"number" => "1040",
"matricula" => ""
],
"mensagem" => [
"type" => "document",
"content" => base64_encode($varre),
"id_provedor" => '6545243524333',
"dst" => "556596107663",
"uniqueid" => 1638196372,
"file_name" => 'bruno',
"media" => "whatsapp",
"datetime" => 1638196372,
"status" => "sent",
"mimetype" => "application/pdf"
]
]];
$request->setUrl($url);
$header = array();
$header[] = 'Content-Type: application/json';
$request->post_field(json_encode($data), true);
$request->header($header);
$request->method_request("POST");
$response = $request->exec_request();
// echo base64_encode($varre);
Loading…
Cancel
Save