Browse Source

the worst code you've ever seen

Ahwx 2 years ago
parent
commit
91ab6ff4d4
5 changed files with 68 additions and 29 deletions
  1. 39 0
      api.php
  2. 7 0
      config.php
  3. 6 29
      index.php
  4. 6 0
      static/footer.php
  5. 10 0
      static/header.php

+ 39 - 0
api.php

@@ -0,0 +1,39 @@
+<?php
+$config = require "config.php";
+require "example/path.php";
+
+if (!isset($_REQUEST["q"]))
+{
+  echo "<p>Example API request: ./api.php?q=pinternet";
+  die();
+}
+
+$query = $_REQUEST["q"];
+
+// Pinterest API Endpoint
+$api_url = "https://api.pinterest.com/v1/boards/{board_id}/pins/";
+
+// Replace {board_id} with the actual board ID
+$board_id = "replace_with_actual_board_id";
+
+// Replace {access_token} with a valid Pinterest access token
+$access_token = "replace_with_actual_access_token";
+
+// Create the API request URL
+$request_url = $api_url . "?access_token=" . $access_token;
+
+// Send a GET request to the Pinterest API
+$response = file_get_contents($request_url);
+
+// Decode the JSON response into a PHP array
+$pins = json_decode($response, true);
+
+// Loop through the pins and display each one
+foreach ($pins["data"] as $pin) {
+  echo '<div>';
+  echo '<img src="' . $pin["image"]["original"]["url"] . '" alt="' . $pin["description"] . '">';
+  echo '<p>' . $pin["description"] . '</p>';
+  echo '</div>';
+}
+
+?>

+ 7 - 0
config.php

@@ -0,0 +1,7 @@
+<?php
+
+
+// options
+
+
+?>

+ 6 - 29
index.php

@@ -1,29 +1,6 @@
-<?php
-
-// Pinterest API Endpoint
-$api_url = "https://api.pinterest.com/v1/boards/{board_id}/pins/";
-
-// Replace {board_id} with the actual board ID
-$board_id = "replace_with_actual_board_id";
-
-// Replace {access_token} with a valid Pinterest access token
-$access_token = "replace_with_actual_access_token";
-
-// Create the API request URL
-$request_url = $api_url . "?access_token=" . $access_token;
-
-// Send a GET request to the Pinterest API
-$response = file_get_contents($request_url);
-
-// Decode the JSON response into a PHP array
-$pins = json_decode($response, true);
-
-// Loop through the pins and display each one
-foreach ($pins["data"] as $pin) {
-  echo '<div>';
-  echo '<img src="' . $pin["image"]["original"]["url"] . '" alt="' . $pin["description"] . '">';
-  echo '<p>' . $pin["description"] . '</p>';
-  echo '</div>';
-}
-
-?>
+<?php require "static/header.php"; ?>
+</head>
+<body>
+<h1>Pinternet</h1>
+<p>It is currently not possible to use Pinternet to search Pinterest.</p>
+<?php require "static/footer.php"; ?>

+ 6 - 0
static/footer.php

@@ -0,0 +1,6 @@
+<div class="footer">
+  <a href="./api.php" target="_blank">API</a>
+  <a href="https://github.com/Ahwxorg/Pinternet/" target="_blank">Source code</a>
+</div>
+</body>
+</html>

+ 10 - 0
static/header.php

@@ -0,0 +1,10 @@
+<!DOCTYPE html >
+<html lang="en">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <meta charset="UTF-8"/>
+    <meta name="description" content="A privacy respecting meta search engine."/>
+    <meta name="referrer" content="no-referrer"/>
+    <link rel="stylesheet" type="text/css" href="static/css/styles.css"/>
+    <link title="LibreX search" type="application/opensearchdescription+xml" href="/opensearch.xml?method=POST" rel="search"/>
+    <link rel="stylesheet" type="text/css" href="static/style-dark.css">