Skip to content

Instantly share code, notes, and snippets.

@Rican7
Created December 6, 2013 17:38
Show Gist options
  • Save Rican7/7828971 to your computer and use it in GitHub Desktop.
Save Rican7/7828971 to your computer and use it in GitHub Desktop.
Sorry ParamoreDigital... http://paramoredigital.com/color
<?php
// Set the THINGS!!!!
$endpoint = 'http://colorapi.paramore.s2.paramoreredd.com/color-queue';
$color_id = 5; // Purple???
// Create the curl
$curl = curl_init();
// Set some options
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1, // Return the response instead of outputting it
CURLOPT_URL => $endpoint,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => array(
'color_id' => $color_id,
),
));
while (true) {
// Execute!
$returned = curl_exec($curl);
if (null !== $returned) {
$returned = json_decode($returned, false);
if (isset($returned->error) && $returned->error) {
echo 'ERROR: API response error: '. $returned->error. PHP_EOL;
} else {
echo 'SUCCESS! Got a response!'. PHP_EOL. PHP_EOL;
// Output the response parts
echo 'Message: '. $returned->response->message. PHP_EOL;
echo 'Time Until Live: '. (int) $returned->response->time_until_live. PHP_EOL;
echo 'Queue ID: '. (int) $returned->response->queue_id. PHP_EOL;
echo PHP_EOL;
}
} else {
echo 'ERROR: No response... hmm.'. PHP_EOL;
}
// Output our returned response
// var_dump($returned);
// Chill for a lil
sleep(1);
}
curl_close($curl);
exit();
@benwilkins
Copy link

Hey Trevor-

Funny thing... When I built the API for Paramore Color, I figured someone would try this exact hack. To prevent it from FULLY working, we built in a rule that there can only be one instance of each color in the queue at a time. That way, there weren't 130,000 instances of the color purple sitting in our queue when you ran your script. Someone could still change the sign to another color and see it change, but then it obviously would go back to Purple a few seconds later.

Also, thanks to you, there's now an IP Blacklist. Of course, that could be countered by using something like Tor, but if you're going to that lengths to try to hack a sign that just changes colors, well, joke's on you I suppose.

Anyway, not a bad attempt! I would have done the same thing myself had I not built the thing. If you're in Nashville, feel free to stop by. We'll give you the tour.

-Ben.

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