index.php 833 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. // Pinterest API Endpoint
  3. $api_url = "https://api.pinterest.com/v1/boards/{board_id}/pins/";
  4. // Replace {board_id} with the actual board ID
  5. $board_id = "replace_with_actual_board_id";
  6. // Replace {access_token} with a valid Pinterest access token
  7. $access_token = "replace_with_actual_access_token";
  8. // Create the API request URL
  9. $request_url = $api_url . "?access_token=" . $access_token;
  10. // Send a GET request to the Pinterest API
  11. $response = file_get_contents($request_url);
  12. // Decode the JSON response into a PHP array
  13. $pins = json_decode($response, true);
  14. // Loop through the pins and display each one
  15. foreach ($pins["data"] as $pin) {
  16. echo '<div>';
  17. echo '<img src="' . $pin["image"]["original"]["url"] . '" alt="' . $pin["description"] . '">';
  18. echo '<p>' . $pin["description"] . '</p>';
  19. echo '</div>';
  20. }
  21. ?>