This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* BEM VINDO | |
* | |
* Esse é o Endpoint para uma Skill de exemplo na Alexa. | |
* Dúvidas, sugestões ou uma conversa aberta, por favor me encontre no Twitter: @giovanenott | |
* | |
* @author: Giovane Machado | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// A requisição traz conteúdo em JSON, então nós transformamos em um belo array utilizável | |
$arrContent = json_decode(file_get_contents("php://input"), TRUE); | |
// Se você der uma olhada completa no $arrContent, verá que há muitas informações úteis. Pegaremos agora o tipo da requisição. | |
$strRequestType = $arrContent["request"]["type"]; | |
switch ($strRequestType) { | |
case "LaunchRequest": | |
$arrResponse = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// A requisição traz conteúdo em JSON, então nós transformamos em um belo array utilizável | |
$arrContent = json_decode(file_get_contents("php://input"), TRUE); | |
switch ($strRequestType) { | |
case "LaunchRequest": | |
$arrResponse = ["response"]; | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// A requisição traz conteúdo em JSON, então nós transformamos em um belo array utilizável | |
$arrContent = json_decode(file_get_contents("php://input"), TRUE); | |
// Prepara e responde a requisição, no formato exigido pela Amazon | |
header('Content-Type: application/json;charset=UTF-8'); | |
echo json_encode($arrResponse); | |
die(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_between_word( $string, $start = "", $end = "" ) { | |
if ( strpos( $string, $start ) !== false ) { | |
$startCharCount = strpos( $string, $start ) + strlen( $start ); | |
$firstSubStr = substr( $string, $startCharCount, strlen( $string ) ); | |
$endCharCount = strpos( $firstSubStr, $end ); | |
if ( $endCharCount == 0 ) { | |
$endCharCount = strlen( $firstSubStr ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Caminho do servidor | |
$where_read = ABSPATH . 'caminho/para/os/arquivos'; | |
// Pega apenas arquivos, ignorando o que não tiver extensão ( pastas ) | |
$files_array = glob( $where_read . "/*.{*}", GLOB_BRACE ); | |
$upload_dir = wp_upload_dir(); | |
foreach( $files_array as $file ): | |
/** |