Connect with us

Web Development

How to Integrate Instagram API and Feed on PHP Website

Published

on

How to Integrate Instagram API and Feed on PHP Website

Few can argue that Instagram is one of the most powerful and engaging social media platforms across the internet right now. It has more than 700 million monthly active users (MAUs) and about 400 million active users per day (DAUs). No surprise that many merchants and companies are already using Instagram as their primary sale or promotion channel.

Taking into account that 65% of customers are engaged in online shopping and social media, integrating Instagram may actually provide you a huge boost in sales and conversions. We’d like to share two most popular Instagram website integrations: social login and feed streaming and teach you how to integrate API into a website.

Login with Instagram Using PHP

It must be acknowledged that the shorter registration form – the higher conversion rates. Users are not willing to spend hours filling in long forms. The feature we’re going to integrate will allow your users to quickly login by using only their Instagram account password.

Moreover, making this function available you still will be able to collect all valuable user data required for targeting, email newsletters, and analytical purposes.

Information that can be obtained through Instagram API:

  • User info
  • User feeds
  • User media
  • User likes
  • User follows
  • User follower
  • User Relationship
  • Search media
  • Get media
  • Popular media
  • Media likes
  • Media comments
  • Like media
  • Delete like media
  • Get location
  • Get location media
  • Search location

Step #1 Registering your Application

Instagram dev mode
  • Login on www.instagram.com;
  • Go to the developer account https://www.instagram.com/developer/ ;
  • Click on “Register Your Application” button;
  • Register new client ID;
  • In “Website URL” field use your website address or localhost if you’re using it;
  • In “Redirect URL” field type location where the response will be handled (e.g. http://yourwebsite/yourprojectfolder/callback.php );
  • Go to Manage Clients tab. From here you can acquire your Client ID and Client Secret.

Step #2 User Flow

The principle of Instagram Authentication is quite simple. User clicks on “Login with Instagram” button. The request is redirected through Authorization URL to Instagram. It`s like magic.

Here’s the structure of Authorization URL:

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code

In response, Instagram will provide you with the code in the following format:

https://your-redirect-uri?code=CODE

Get this code from URL

Step #3 Access Token

Next, you’ll need an access token. In order to acquire it you’ll need to make an array with the following data:

  • Client ID.
  • Client Secret.
  • Redirect URL.
  • Grant Type.
  • Code from Step #2.
$url = "https://api.instagram.com/oauth/access_token";
$header = 0; // header = 0, because we do not have header
$data = array(
"client_id" => $client_id,
"client_secret" => $client_secret,
"redirect_uri" => $redirect_uri,
"grant_type" => "authorization_code",
"code" => $code
);

You can call it and pass this URL using CURL

Step #4 Getting User Information

Finally, after getting access_token you can call this URL https://api.instagram.com/v1/users/self/?access_token=$access_token) and get User Data.

Data you will acquire:

  • Full Name.
  • Website.
  • Bio.
  • Followers Count.
  • Following Count.
  • Profile Picture.

That’s it, and good luck.

Just kidding! Here is a folder with all files required for integration of Instagram Login on your website using PHP.

How to integrate Instagram feed to your website without API

Most tutorials on how to implement Instagram feed suggest to use Instagram API. And while there is nothing wrong with this method, there is an easier way without actually using this API.

The first thing we need to do is to get a feed data from Instagram.

Here’s a code sample for this task:

<?php
$username = 'YourUserName';
$json = file_get_contents('https://www.instagram.com/'.$username.'/media/');
$instagram_feed_data = json_decode($json, true);
?>

For the “name” field use your username as it shown in Instagram’s address line.

The string $instagram_feed_data = json_decode($json, true); indicate the data will be contained and decoded. The data will be decoded into the array.

Basically, in your array, the data about each post will be structured into [“items”]. Each item contains the information about every single post including user info, images, the caption, likes, comments, etc.

This is the information we’ll gonna use. But first, you should check if there are any items in the array. Here’s how to make this:

if (isset($instagram_feed_data['items'])) 
foreach ($instagram_feed_data['items'] as $item) }

Next, you’ll need to get an actual post link and image URL. Keep in mind that the array contains image URLs in multiple formats: thumbnail, low_resolution, and standard_resolution. You may choose one of those formats depending on your needs.

In our case, we’ll be ok with low resolution.

$link = $item['link'];
$img_url = $item['images']['low_resolution']['url'];

In addition, you can take a caption. In case of Instagram posts there isn’t always a caption, so you’ll need to check whether it exists first.

$caption = isset($item['caption']) ? $item['caption']['text'] : '';

Streaming

Now, when feed data is acquired we can stream to your webpage. Let’s start with the images by using image URLs. Since this URL is leading to an external web resource (Instagram), we’ll make the target blank. Then, list output of actual image and caption.

<a href="<?= $link; ?>" target="_blank" class="instagram-post">

<img src="<?= $img_url; ?>">
<div class="caption"><?= $caption; ?></div>

That’s it. All you need is to compose all these code strings into one script. Here’s it by the way.

if (isset($instagram_feed_data['items'])) {
    foreach ($instagram_feed_data['items'] as $item) {
        $link = $item['link'];
        $img_url = $item['images']['low_resolution']['url'];
        $caption = isset($item['caption']) ? $item['caption']['text'] : '';
        
        ?>
        <a href="<?= $link; ?>" target="_blank" class="instagram-post">
            <img src="<?= $img_url; ?>">
            <div class="caption"><?= $caption; ?></div>
        </a>
        <?php
    }
}
?>

Use this simple script that will get images, caption and links from the Instagram feed with no API. With little CSS magic, you can turn this data into such a good-looking web page.

How to Integrate Instagram API and Feed on PHP Website

Hope you found what you looked for.

REFERENCES

  • https://www.instagram.com/developer/
  • https://developers.facebook.com/docs/instagram-basic-display-api
  • https://developers.facebook.com/docs/instagram-api/
Continue Reading
Click to comment

Leave a Reply

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

Web Development

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

Published

on

By

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

Design portfolios to Inspire You!

➡ Where can I find good Ideas?
➡ Where to get Inspiration?
➡ Where can I ask a Question?
➡ Where can I hire Developers for my App Idea?
➡ Tips to make own HOT Portfolio

Where to find Website Developer:

  • Upwork is a marketplace for freelancers. Highly recommended for web developers.
  • Clutch List of Web Development Company with truthful Reviews.
  • Freelancer is a marketplace for all types of freelance positions, including web designers, graphic designers, etc.
  • Fiverr is the largest freelance services marketplace.
  • Craigslist worldwide job-board to find graphic designers.
  • How To Find a Good Web Designer?
15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

Web Developers, You Want to Work within 2021

Do you want to be on this List?

Apply Now! [for 2.99 USD]

1. Sharon Yi

When you scroll through Sharon Yi’s portfolio you immediately get a sense of her personality through the playful color palette and addition of emojis. Sharon is currently working at Indigo as a Front-End Developer and the projects section on her website showcases the interactive and creative web development work that she’s capable of!

Coming from a background in design, I love creating pages where I’m able to actually create enjoyable interactions and experiences for everyone! And with Juno’s education and support, I’m now able to truly call myself a Front-End Developer who is currently working at Indigo!

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

➡ Load Web Portfolio Example or Looking TOP Promo Websites.

2. Rafael Caferati

Caferati.me

What Rafael does: Full Stack Web Developer and UI/UX Javascript specialist.
Type: Private. Location: London, England

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

Rafael`s Portfolio

Where can i find Portfolio Template to Showcase my Skills and Get dream tech job?

More than 50 Fresh Templates for creative personal web development portfolios:

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

3. Robin Mastromari

Robin Mastromarino

Expert in: UI / UX Designer at HETIC
Type: Private. Location: Paris

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

4. Ian Lunn

ianlunn.co.uk

Expert in: Producing HQ responsive websites and exceptional UX
Type: Private. Location: Devon, UK

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

5. Timmy O’Mahony

timmyomahony.com

What Timmy does: Full-Stack Web & Software Development
Type: Private. Location: Dublin, Ireland.

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

6. Pierre Nel

pierre.io

Expert in: UX/UI Design, full-stack development
Type: Private. Location: London, UK
Star Trek Fan

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

7. Richard Hill

Richard-hill.org.uk

About: creative freelance digital designer
Type: Private. Location: Leeds, UK

Day rate is £450

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

8. Ben Adam

benadam.me

a Designer / Front End Developer
Type: Privat. Location: Tempe, AZ, USA
Currently not accepting freelance work.

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

9. Daniel Fischer

www.danielfischer.com

Expert in: Pocket CTO for Project
Type: Private. Location: San Francisco, California

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

10. Kay Evans-Stocks

Kay Evans-Stocks is a creative developer and graphic designer that’s passionate about building digital experiences that nurture community, inclusivity, and knowledge. For each project she’s worked on, Kay’s taken the time to put the spotlight on the organization she worked with, while highlighting the project goals. When you browse her portfolio you immediately get a feel for her creative design approach and the work that she’s capable of!

I am a creative designer and developer, who aims to work with small businesses and marginalized communities to bring their passions to life. I offer both design and development services of web applications or websites!

Expert in: Design Engineer at Tucows
Type: Private.
Location: Toronto, Ontario, Canada

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

* Marek Kaleta currently out of order

MrkPortfolio.pl

Expert in: digital/graphic design, UI/UX
Type: Private. Location: Warshaw, Poland

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

Bonus: WordPress Developers Portfolio:

* Emily Ridge

www.emilyridge.ie

Expert in: custom WordPress developer and designer
Type: Private. Location: Salthill, Galway, Ireland

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

Front End Developers Portfolio:

* Jack Jeznach (Awwwords Winner)

JacekJeznach.com

What he does: front-end and WordPress development

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

Mees Verberne

https://meesverberne.com/

What he does: creative front-end development and design

Mees Verberne

Describing himself as a highly-creative, front-end developer and designer, Mees Verberne makes use of glitching, to give the site some extra character. He also uses banded gradients that give the look of a gentle lighting.


UI Developers Portfolio:

* Matt Farley

mattfarley.ca

Expert in: UX/UI and front-end development
Type: Private. Location: Abbotsford, British Columbia.

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

* Adham Dannaway

What he does: UX/UI Designer & FB Developer — adhamdannaway.com

15 Web Developer Portfolio List ✯✯✯✯✯ in September 2021

Disclaimer

Really feel the inspiration for starting a career in the field of web development, only at your own risk. If you could not find inspiration from the portfolios above, pay attention to such resources.

How to Increase your Website Designer Offers? Just add your portfolio to this list here (fee is 5 EUR)!

Continue Reading

Web Development

The best tool for A/B tests for UI or CRO

Published

on

By

The best tool for A/B tests for UI or CRO

I have two points for which I occasionally try to be persecuted:

  1. If you don’t know which tool to choose, then choose any tool. And this is most likely Google Optimize.
  2. You don’t need to know the under-the-hood math of A/B testing. Look at the tool’s “Win/Lose” messages.

https://optimize.google.com/optimize/home/

The best tool for A/B tests for UI or CRO

So why do I think that?

  1. If you don’t know which tool to choose, chances are you have no or very little experience in A/B testing. To get that same experience, it’s important to start as soon as possible.
  2. If you don’t know which tool to choose, it means you have no requirements for the tool. If there were real requirements, a simple comparison of functionality would quickly solve the problem. And if there are no requirements, then anything will do.
  3. Knowing the under-the-hood math will help if you write your tool from scratch. In other cases, it’s practically useless: you can’t change the Google Optimize algorithm(s) and/or other tools.

It seems like picking the best tool and figuring out the under-the-hood math is very, very right. The devil lies in the definition of “right.” I insist that speed of motion (start early) is more important in most cases. In that time, you will have time to do more and get better results than that gain from a better tool and knowledge of math.

Run experiments whose wins will be reported to you by accounting, not by the analytics system.

Continue Reading

Web Development

CodeIgniter 4: Build a Complete Web Apps from Scratch

Codeigniter is a popular PHP-based web application platform for building high-quality web apps, websites, content management systems, and e-commerce stores.

Published

on

By

CodeIgniter 4: Build a Complete Web Apps from Scratch

Web development has progressed significantly as a result of the widespread use of mobile devices and the digitization of industries, and specific solution-based application development has become a requirement of the hour. Developing multi-device supporting solutions that are reliable, scalable, and stable has become the most in-demand service in today’s world.

PHP is an open-source scripting language among developers because of its ease of use. To put it another way, the PHP framework supports the creation of a simple platform for companies and entrepreneurs to build seamless web applications. This framework enables developers to use pre-built modules rather than writing repetitive code, saving time and allowing for a shorter development cycle, resulting in faster app development.

Best-in-class coding practices and development procedures are included in the PHP framework, which aids in the coordination and protection of the process. 

CodeIgniter and its various aspects

CodeIgniter is a website-building framework based on the PHP programming language. It’s a completely free framework to use. It features several advantages such as easy to upload and operate your website.

Codeigniter is a perfect solution for those who want to build projects from scratch without the need of installing any other software on their machine.

If you know PHP, CodeIgniter will facilitate your work. It comes with a multitude of libraries and assistants. If you build a site from the ground up, CodeIgniter will save you a lot of time. Furthermore, a CodeIgniter website development is safe, as it can prevent a variety of website-based attacks.

CodeIgniter is a lightweight PHP framework for developers who want to develop complete, simple, elegant Web applications. CodeIgniter is a technology institutional document developed by EllisLab and is a British Columbia Institute project.

A developer may choose to master one or more of the frameworks mentioned above, but the one that is the most current in terms of market dynamics and demand should be prioritized over the others. See the benefits and disadvantages of using CodeIgniter website development.

Advantages of CodeIgniter website development

CodeIgniter is a PHP MVC framework that allows developers to quickly create full-featured dynamic applications. The MVC (Model-View-Controller) architecture of CodeIgniter helps create multiple processes of the development cycle simultaneously with successful design, with a variety of libraries and packages enabling linking databases to perform diverse operations such as file uploads, session management, email sending, and more.

MVC Architecture

The MVC (Model-View-Controller) framework is used by CodeIgniter to create website designs. MVC is an architecture or design model used in the development of websites. The design structure is divided into three parts, as the name suggests, allowing for easy customization.

  • Model – The model, which is in charge of data management, establishes the base layer.
  • View – The data would be then forwarded to the receiver.
  • Controller – The controller’s role is to keep all of the previous levels’ links on the same page.

Form Validations

The form validation feature is critical in web application development. It allows you to capture and file data in the appropriate format. It also makes the job of developers much easier and more enjoyable. The CodeIgniter system makes custom validation easy, and it comes with a number of built-in type validations, making it unsuitable for scripts.

Inbuilt Security Tools

In PHP CodeIgniter website development facilities, excluding slashes when recovering data from the database is a common practice. Due to built-in security tools, these patches are interpreted in default settings. When feeding to a query, these default settings fix the database problem by disabling the runtime guidelines for magic quotes. Thanks to these useful features, the CodeIgniter website development process is quick and easy for developers.

Error Handling

During the CodeIgniter website development process, developers who use the CodeIgniter web application development framework may find it easier to access error reports. The framework also supports the saving of debugging messages as text files with error logging class instructions. This feature is extremely useful for programmers.

Database Caching Class

The following easy steps can be found for the cache. Reduce loading by storing text file queries.

  • Build a writeable directory on the server that stores and saves cache files
  • Set the path to the cache folder in the application/config/database.php file
  • You can turn on the caching function globally or manually in the application/config/databank.php file.

Since CodeIgniter has a simple integration feature, cutting-edge web applications developed with it can help businesses all over the world, making it the most preferred web platform for developers.

How to find a skilled team to outsource Codeigniter development?

Codeigniter is a popular open-source PHP web application framework. It’s a powerful and flexible tool for experienced programmers, but it’s also a great option for beginners.

In this section there are some tips on how to find codeigniter developers:

You should look into their online portfolio and check the quality of their projects as well as the number of projects that they have done in the past. You can also ask them about what type of freelance jobs they prefer, or if they prefer working with one company or multiple clients at once.

Conclusion

Codeigniter framework is a popular PHP-based web application platform for building high-quality web apps, websites, content management systems, and e-commerce stores. The framework combines a highly immersive interface with a collection of simple tools to make it ideal for developers. Codeigniter is a common option due to additional features such as simplicity, versatility, and security. If you want to have a smart and vibrating web application, you should use CodeIgniter website development

Continue Reading

Trending