Connect with us

How to Download Instagram Photo and Video using PHP (easy way)

kizinho

Published

on

Follow
NEWS: How to Download Instagram Photo and Video using PHP (easy way)  [New  Developer] » Naijacrawl
Photo: Naijacrawl
site

Hi folks, this script is really cool for those of you that want to get informations like photos and videos from Instagram, this tool is for you.

 

Assuming you are working on a project that needs to get data from Instagram just follow these steps and get it done.

 

Step 1 

Download this package using the following command 

 

composer require ayesh/instagram-download

 

Step 2 

 

Set your Instagram photo or video URLs as show below 

 

getDownloadUrl(); // Returns the download URL.
  $type = $client->getType(); // Returns "image" or "video" depending on the media type.
}
catch (\InvalidArgumentException $exception) {
  /*
   * \InvalidArgumentException exceptions will be thrown if there is a validation 
   * error in the URL. You might want to break the code flow and report the error 
   * to your form handler at this point.
   */
  $error = $exception->getMessage();
}
catch (\RuntimeException $exception) {
  /*
   * \RuntimeException exceptions will be thrown if the URL could not be 
   * fetched, parsed, or a media could not be extracted from the URL. 
   */
  $error = $exception->getMessage();
}

 

You are good to go.

 

 

Features:

 

1.Validates Instagram URL (domain validation, URL path validation).

 

2.Uses OG properties to detect the image and video URL.

 

3.Supports Instagram photos, videos, and Instagram TV videos Verbose error reporting with proper exceptions.

 

4.Full unit tests No dependencies other than PHP curl extension (which is most likely enabled by already)

 

This awesome script written by Ayesh, Visit their official github repository and follow for future updates.

 

Demo

 

Enjoy.

Click Here To Comment

Download File 6.66 Kb 19


site


kizinho

Adike Kizito is a top-rated software developer, blogger, sports, and entertainment lover. He is the CEO of these popular websites Naijacrawl.com and Mp3ager.com. He operates his software developing task through Kizzsoft.com,... Read More

Continue Reading
Click to comment

Be first to comment


    Leave a Reply

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

    PHP 7.3 Released

    kizinho

    Published

    on

    NEWS: PHP 7.3 Released [New  Developer] » Naijacrawl
    Photo: Naijacrawl
    Yesterday the PHP team released PHP 7.3.0 for general availability (GA) and marked the third feature update to PHP 7. You can download the latest version from the official PHP downloads page. You can also get all the nitty-gritty details about PHP 7.3 by reading the PHP 7 changelog on the official site. While today marks the day of the stable release, you will have to wait a bit longer for the migration guide, which should be available shortly. If you haven...
    Continue Reading

    Upload files to Amazon S3 from the browser using pre-signed post (Laravel, Vue.js/Nuxt.js)

    kizinho

    Published

    on

    DEVELOPER PROGRAMMING: Upload files to Amazon S3 from the browser using pre-signed post (Laravel, Vue.js/Nuxt.js) [New  Developer Programming] » Naijacrawl
    Photo: Naijacrawl
    Upload files to Amazon S3 from the browser using pre-signed post (Laravel, Vue.js/Nuxt.js)This article was written by Okonkwo Buchi Flair a ccolleague of mind, read and know how to simply upload your files via Amazon S3.original article can be found hereBefore I begin I would love to point out that is my first post so please pardon me any errors you may find as you read alongRecently I’ve been working on a e-learning platform which of course was going to deal with a...
    Continue Reading

    How to show a nice message to the user when an error occurs in using Guzzle with Laravel

    kizinho

    Published

    on

    DEVELOPER PROGRAMMING: How to show a nice message to the user when an error occurs in using Guzzle with Laravel [New  Developer Programming] » Naijacrawl
    Photo: Naijacrawl
    Hi Folks, have you encountered an ugly Exception when making a post, get, put, delete to external API when an error like 500 or 404 occurs. Today you are at the right place, after reading this you will be able to show a nice message to your users in case of any of those errors occursWhen making a request to external API using guzzle to solve this problem you will need to catch the Exception by following the steps below.Prepare your request using Guzzle, I believe yo...
    Continue Reading

    Latest