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 | |
//il seguente snippet per fare richiesta get e cercare una carta per nome | |
//funzione che ti fa la chiamata | |
function trovaCarta($nome_carta_da_cercare){ | |
$richiesta = file_get_contents("https://api.scryfall.com/cards/named?fuzzy=".$nome_carta_da_cercare ); | |
//attenzione: non va fatto json_ecnode() perchè già json | |
//attenzione: se va trattata in php come array multidim va fatto json_decode() | |
return $richiesta; | |
} | |
//questo lo uso solo per stampare il rislutato, il set dell'header va tolto se non elabori il json in javascript chiamando questa funzione |
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
//questo ti serve solo se vuoi mandare notifiche via web | |
//semplicemente registra una macchina ad un id, così tu poi puoi mandare notifiche anche ai singoli client | |
link(rel="manifest" href="/manifest.json") //il file manifest te lo da onesignal | |
script(src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async) | |
script. | |
var OneSignal = window.OneSignal || []; | |
OneSignal.push(["init", { | |
appId: "il-tuo-id", | |
autoRegister: true, | |
notifyButton: { |
OlderNewer