Posted on Leave a comment

PHP Pinterest Downloader Script Source Code How to Develop

In this article, we will guide you through the process of creating a PHP based Pinterest Image Downloader. You’ll find comprehensive information and the accompanying source code that can be integrated into your website. Additionally, at andamantech.com, we offer an enhanced pro version of this tool for purchase. Our premium all-in-one Pinterest Downloader source code comes complete with a live demo for your convenience.

Start creating your own basic Pinterest Downloader with PHP. Follow these simple instructions to craft a PHP Pinterest Downloader that suits your requirements. The provided source code offers a minimalist, one-page solution for downloading from Pinterest. This version intentionally avoids using CSS and JavaScript, resulting in a simple page design. This approach focuses on functionality, providing an uncomplicated and effective tool for Pinterest content downloads.

Step 1: Project Setup

Begin by establishing your project environment. Create a fresh directory on your web server to serve as the home for your project files. Feel free to choose a name for the directory folder name, such as “pinterest-downloader

Step 2: Create the HTML Interface

Within the project directory, generate an PHP file named “index.php” to act as the user interface. Employ fundamental HTML components like a form for inputting the Pinterest image URL.

<title>Pinterest Image Downloader</title>
<form method="POST">
    <input type="text" name="url" placeholder=" https://in.pinterest.com/pin/658299670523298984/" value="">
    <input type="submit" name="submit">

</form>

In the preceding code, you’ll find a basic HTML form.

Step 3: Integrate PHP Functionality

Afterwards, the PHP curl_init function is utilized to fetch the image path from Pinterest. This path is then presented within an HTML tag, designated with the class name “preview.”

<?php
function search($pin_url) {
    $curl = curl_init($pin_url);
    curl_setopt($curl, CURLOPT_URL, $pin_url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $res = curl_exec($curl);
    curl_close($curl);
    return $res;
}
echo "Pinterest Image Downloader";
?>
<title>Pinterest Image Downloader</title>
<form method="POST">
    <input type="text" name="url" placeholder=" https://in.pinterest.com/pin/658299670523298984/" value="<?php if(isset($_POST['url'])){echo $_POST['url'];} ?>">
    <input type="submit" name="submit">
    <?php
    if (isset($_POST['submit'])) {
        if (empty($_POST['url'])) {
            echo "<br />Please input the URL";
        }
        else {
            $ser_pint = search($_POST['url']);
            $pint_im = explode('href="https://i.', $ser_pint);
            if (isset($pint_im[1])) {
                $pint_im2 = explode('" as="image"/>', $pint_im[1]);
?>
</form>
<div class="preview">
    Preview Image
    <br />
    <img width="300px" src="<?php echo "https://i.$pint_im2[0]"?>">
</div>
<div class="download">
    <a href="<?php echo "https://i.$pint_im2[0]"?>" target="_blank">Download the Original Size</a>
</div>
<?php
            } else {
                echo "<br />Please input the correct URL.";
            }
        } 
    }

?>

Usage Instructions:

  1. Enter your Pinterest URL into the input box. (For instance: https://in.pinterest.com/pin/658299670523298984/)
  2. Click the submit button.
  3. The preview image will be displayed.
  4. Download the full-size/original image by clicking the download button beneath the preview image.


Utilize this tool to effortlessly retrieve Pinterest images by providing their URLs—no need for an API. You’re welcome to utilize or adapt this source code to fashion your personal Pinterest image downloader for your ventures. Tailor it to your preferences. Should you have any inquiries, don’t hesitate to ask by dropping a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *