Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidbuchweitz/0589903ccf42f6055262b01937855a88 to your computer and use it in GitHub Desktop.
Save davidbuchweitz/0589903ccf42f6055262b01937855a88 to your computer and use it in GitHub Desktop.
Let's Logic API Examples
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
#######################
# Get all collections #
#######################
// curl_setopt($ch, CURLOPT_URL, "https://letslogic.com/api/v1/collections");
// curl_setopt($ch, CURLOPT_POSTFIELDS, 'key=44fe26c95c2b940784b728f1c25cd888b71212d65d94aa184f7bac31bbcc9e34');
// $collections = json_decode(curl_exec($ch), true);
// var_dump($collections);
// curl_close($ch);
// foreach($collections as $collection)
// print_r($collection);
#############################
# Get levels in collection #
#############################
// curl_setopt($ch, CURLOPT_URL, "https://letslogic.com/api/v1/collection/488");
// curl_setopt($ch, CURLOPT_POSTFIELDS, 'key=44fe26c95c2b940784b728f1c25cd888b71212d65d94aa184f7bac31bbcc9e34');
// $levels = json_decode(curl_exec($ch), true);
// curl_close($ch);
// foreach($levels as $level)
// print_r($level);
####################
# Submit solution #
####################
curl_setopt($ch, CURLOPT_URL, "https://letslogic.com/api/v1/level/522");
curl_setopt($ch, CURLOPT_POSTFIELDS, 'key=44fe26c95c2b940784b728f1c25cd888b71212d65d94aa184f7bac31bbcc9e34&solution=dlUrrrdLullddrUluRuulDrddrruLdlUU');
var_dump(curl_exec($ch));
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment