Hey, ich probiere das jetzt schon die ganze Nacht lang.. mit php die Rest api einbinden und wenn es ein bestimmter Wert ist, soll er eine Pushbenachrichtigung an mein Handy senden.. Wie mache ich das am Besten? Ist das überhaupt mit php möglich? (besonders hilfreich wären codebeispiele zum anschauen und verstehen..) Und kann jemand anderes mal diese Website testen (https://fortnitetracker.com/site-api), ob die Api überhaupt funktioniert?.. (bis jetzt habe ich es noch nicht hingebracht..)(ich will die shop api haben)
Vielen Dank im Voraus! Wäre sehr hilfreich!
Verwandte Themen
Fortnite Api geht nicht?
Computer,
Internet,
Browser,
Technik,
Webseite,
programmieren,
Design,
CSS,
Java,
JavaScript,
Informatik,
PHP,
web-development,
API,
api key,
JSON,
Fortnite,
Spiele und Gaming
Twitch API mit HttpURLConnection läuft nicht?
Moin an alle,
ich würde gerne auf die Twitch API zugreifen und abfragen ob ein bestimmter Kanal grade Streamt.
Hier der Code:
String Streamer = "Test";
URL url;
HttpURLConnection connection = null;
try{
//create connection
url = new URL(("https://api.twitch.tv/kraken/channels/" + Streamer));
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Client-ID",
Secrets.twitch_clientid);
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
//Send request
DataOutputStream wr = new DataOutputStream(
connection.getOutputStream());
//Get response
InputStream is = connection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();
while((line = rd.readLine()) != null){
response.append(line);
response.append('\r');
}
rd.close();
System.out.println(response.toString());
} catch (Exception e){
e.printStackTrace();
System.out.println("NULL");
} finally {
if (connection != null) {
connection.disconnect();
}
}
Was ich als Output bekomme:
java.io.FileNotFoundException: https://api.twitch.tv/kraken/channels/Test
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1923)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1523)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
at me.duncte123.ge.commands.cmdTest.handle(cmdTest.java:47)
at me.duncte123.ge.CommandManager.handleCommand(CommandManager.java:59)
at me.duncte123.ge.Listener.onGuildMessageReceived(Listener.java:60)
at net.dv8tion.jda.core.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:381)
at net.dv8tion.jda.core.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:84)
at net.dv8tion.jda.core.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:95)
at net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37)
at net.dv8tion.jda.core.requests.WebSocketClient.onDispatch(WebSocketClient.java:868)
at
Hat jemand dasselbe Problem auch mal gehabt? Mache ich etwas falsch?
Gruß
Dennis
programmieren,
Java,
http,
API,
Twitch