From 91ab6ff4d487d7f2b51abd2cbf3e6528a56b1e63 Mon Sep 17 00:00:00 2001 From: Ahwx Date: Sat, 4 Feb 2023 17:17:32 +0100 Subject: [PATCH] the worst code you've ever seen --- api.php | 39 +++++++++++++++++++++++++++++++++++++++ config.php | 7 +++++++ index.php | 35 ++++++----------------------------- static/footer.php | 6 ++++++ static/header.php | 10 ++++++++++ 5 files changed, 68 insertions(+), 29 deletions(-) create mode 100644 api.php create mode 100644 config.php create mode 100644 static/footer.php create mode 100644 static/header.php diff --git a/api.php b/api.php new file mode 100644 index 0000000..35e2265 --- /dev/null +++ b/api.php @@ -0,0 +1,39 @@ +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 '
'; + echo '' . $pin['; + echo '

' . $pin["description"] . '

'; + echo '
'; +} + +?> diff --git a/config.php b/config.php new file mode 100644 index 0000000..3724535 --- /dev/null +++ b/config.php @@ -0,0 +1,7 @@ + diff --git a/index.php b/index.php index 8003945..858c81a 100644 --- a/index.php +++ b/index.php @@ -1,29 +1,6 @@ -'; - echo '' . $pin['; - echo '

' . $pin["description"] . '

'; - echo ''; -} - -?> + + + +

Pinternet

+

It is currently not possible to use Pinternet to search Pinterest.

+ diff --git a/static/footer.php b/static/footer.php new file mode 100644 index 0000000..0018961 --- /dev/null +++ b/static/footer.php @@ -0,0 +1,6 @@ + + + diff --git a/static/header.php b/static/header.php new file mode 100644 index 0000000..c830b26 --- /dev/null +++ b/static/header.php @@ -0,0 +1,10 @@ + + + + + + + + + +