Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cheat: Revealing all questions and answers of a Kahoot quiz.
<?php
error_reporting(null);
if(!isset($_GET["pin"]))
die("No PIN?");
$url = "https://kahoot.it/rest/challenges/pin/".$_GET["pin"];
$response = file_get_contents($url);
$jresponse = json_decode($response, TRUE);
$questions = $jresponse["kahoot"]["questions"];
foreach ($questions as $question) {
echo $question["question"].": ".array_pop(array_filter($question["choices"], "check_true"))["answer"]."\n";
}
function check_true($choice) {
return $choice["correct"];
}
?>
@AhOkkay
Copy link

AhOkkay commented Dec 4, 2020

Hi, when I open this file and I add to URL ?pin=[my kahoot pin] the page become blank. How can I run correctly this php code? Thank you
Bye

@Logicbloke
Copy link
Author

Logicbloke commented Dec 5, 2020

Do you get any JSON content when you open the URL directly on the browser? It might be that the structure has been changed from Kahoot.

@PocketNab
Copy link

PocketNab commented Feb 23, 2021

How do i run this php code?

@sahiltipu
Copy link

sahiltipu commented Mar 5, 2021

how to run it

@Logicbloke
Copy link
Author

Logicbloke commented Mar 5, 2021

Put it on a server with Apache or nginx and PHP and provide the pin as a GET parameter.

@sometimesilikenousername

w\

@dbedoyat
Copy link

dbedoyat commented Mar 23, 2021

It works, Thanks!

How to use, download and put in web server like Xampp or FTP

Put the next url in your browser, replace "localhost" as your host if it needed *example for xampp

http://localhost/kahoot.php?pin=KAHOOT_PIN_CODE

@cgtykarasu
Copy link

cgtykarasu commented Mar 23, 2021

@dbedoyat I wrote the pin of game on code, saved it to htdocs (for XAMPP) then I tried to go localhost/kahoot.php on Chrome but it said only "No PIN?" What am I doing wrong?

@Logicbloke
Copy link
Author

Logicbloke commented Mar 23, 2021

@dbedoyat I wrote the pin of game on code, saved it to htdocs (for XAMPP) then I tried to go localhost/kahoot.php on Chrome but it said only "No PIN?" What am I doing wrong?

Put the PIN in the URL, it's a GET parameter.

http://localhost/kahoot.php?pin=PUT_THE_PIN_HERE

@LamaHack73
Copy link

LamaHack73 commented Mar 24, 2021

@dbedoyat I wrote the pin of game on code, saved it to htdocs (for XAMPP) then I tried to go localhost/kahoot.php on Chrome but it said only "No PIN?" What am I doing wrong?

Put the PIN in the URL, it's a GET parameter.

http://localhost/kahoot.php?pin=PUT_THE_PIN_HERE

I put the http://localhost/kahoot.php?pin=mypin , but chrome still writes "No PIN?". Maybe your url https://kahoot.it/rest/challenges/pin/ in the code is out of date because, because if you type it directly into the browser it throws an error, maybe I have to change it to https://play.kahoot.it/reserve/session/pin/, although it still doesn’t help me. Maybe you can record a video on how to do it right?

@cgtykarasu
Copy link

cgtykarasu commented Mar 24, 2021

@dbedoyat I wrote the pin of game on code, saved it to htdocs (for XAMPP) then I tried to go localhost/kahoot.php on Chrome but it said only "No PIN?" What am I doing wrong?

Put the PIN in the URL, it's a GET parameter.
http://localhost/kahoot.php?pin=PUT_THE_PIN_HERE

I put the http://localhost/kahoot.php?pin=mypin , but chrome still writes "No PIN?". Maybe your url https://kahoot.it/rest/challenges/pin/ in the code is out of date because, because if you type it directly into the browser it throws an error, maybe I have to change it to https://play.kahoot.it/reserve/session/pin/, although it still doesn’t help me. Maybe you can record a video on how to do it right?

yeah, it still shows me "No PIN?" too. I agree with you. I think, Kahoot URL in the code has to be changed but I don't know what the correct URL.

@Logicbloke
Copy link
Author

Logicbloke commented Mar 24, 2021

@LamaHack73
Copy link

LamaHack73 commented Mar 25, 2021

@Logicbloke I don’t know what I’m doing wrong, it still doesn’t work for me. Maybe your url is out of date because when I enter it directly in my browser, it give me errorCode 41. Or do I have to put the UUID instead of the game pin?

@Logicbloke
Copy link
Author

Logicbloke commented Mar 25, 2021

@Logicbloke I don’t know what I’m doing wrong, it still doesn’t work for me. Maybe your url is out of date because when I enter it directly in my browser, it give me errorCode 41. Or do I have to put the UUID instead of the game pin?

Maybe the code has changed. I'd be surprised that it changed and someone managed to get it to work just 3 days ago. Also, I don't think it works for all the quizzes, just the ones that are open perhaps.

@gffyctuxtdctcdt
Copy link

gffyctuxtdctcdt commented Apr 5, 2021

How do i get this to work i want to do the kahoot bot spammer but i can not figer this out

@greenreader9
Copy link

greenreader9 commented Aug 23, 2021

Not working for me. I copy-pasted the code into a new .PHP file on my webserver, and am getting an HTTP 500 error. (No, I never get the "No Pin?" message)
The 500 error is given when...

  • No pin is provided
  • An incorrect pin is provided
  • A correct pin is provided.

The Kahoot I created is public. When adding my pin to this URL (https://kahoot.it/rest/challenges/pin/PIN_HERE) I get an error message from Kahoot.

{"fields":{"arg1":"Invalid challenge pin code"},"error":"INVALID_DATA","timestamp":1629727943516,"errorCode":41,"errorId":"d0c05fa69be74f4ca433891db2ed6300"}

Is this code no longer working with the Kahoot API?

@Logicbloke
Copy link
Author

Logicbloke commented Aug 23, 2021

@greenreader9 Probably not. I put this together over a year ago, they probably changed their API a bit. But it seems like you're getting an invalid challenge pin even when querying kahoot directly?

@greenreader9
Copy link

greenreader9 commented Aug 23, 2021

But it seems like you're getting an invalid challenge pin even when querying kahoot directly?

On that domain, yes. It makes me think that the entire system might have been re-done. Do you have any idea how yourself or someone else could get this working again? I found a site that has documentation of the Kahoot! API, but it got shut down.

@Logicbloke
Copy link
Author

Logicbloke commented Aug 23, 2021

When I built this, I was just inspecting the kahoot game and found an endpoint that, when supplied with the pin, was actually revealing all the questions and all the answers all at once. When the game is played, it's just visual on the browser's level. Everything is sent all at once from the get go. Not sure if that's possible still.

@greenreader9
Copy link

greenreader9 commented Aug 23, 2021

Makes sense. If you figure out a way to get it working, let me know. I’ll take a look at the Kahoot code once I run out of other things to do an ill let you know if I find anything :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment