├── LICENSE ├── README.md ├── php-curl-instagram-graph.css └── php-curl-instagram-graph.php /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Eder Ribeiro 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Deprecated: As of December 4, 2024, the Instagram Basic Display API will no longer be available. 2 | 3 | # php-curl-instagram-graph 4 | PHP cURL for feed Instagram Graph API 5 | 6 | Script made based on the new (2020) Instagram API that requires authorization token generated via Facebook Developers. 7 | 8 |
Follow the steps outlined here
10 | 11 |Include the function in your theme an edit the line with your generated token
13 | 14 |Optional compatible CSS style is included in the files.
16 |The size was configured to display 6 columns of photos, edit as needed.
17 | 18 |- It does not work if you do not generate the token and authorize the application/testers.
20 |- The new instagram API still has several limitations.
21 |- The total number of calls your app can make per hour is 240 times the number of users. Please note this isn't a per-user limit. Any individual user can make more than 240 calls per hour, as long as the total for all users does not exceed the app maximum.
22 |- Its use and consumption can be monitored on developers.facebook.com
23 |- Only the 1080px image size is supported.
24 |- Videos are supported! But in this script the default setting opts for the video thumbnail to avoid conflicts.
25 |- Official Graph API Instagram documentation can be found here
26 | 27 |If you prefer jQuery, this script follows the same concepts and classes jQuery Ajax for feed Instagram Graph API
29 | 30 |"Tokens are valid for 60 days and can be refreshed as long as they are at least 24 hours old but have not expired, and the app user has granted your app the instagram_graph_user_profile permission. Refreshed tokens are valid for 60 days from the date at which they are refreshed. Tokens that have not been refreshed in 60 days will expire and can no longer be refreshed." Here is the documentation
32 | 33 |Through this excerpt above we can see that we have a problem with the "non-automatic" renewal of the tokens, we cannot let it expire at risk of inactivation. With just one curl -i -X GET request, we can renew the token, so if you can help with any automated solution, it would be great!
34 | -------------------------------------------------------------------------------- /php-curl-instagram-graph.css: -------------------------------------------------------------------------------- 1 | /* =================================== 2 | Optional styles 3 | ====================================== */ 4 | 5 | .instagram_feed { 6 | overflow: hidden; 7 | } 8 | .instagram_feed .instagram_new { 9 | width: 16.666%; 10 | float: left; 11 | padding: 0 1px 1px 0; 12 | -webkit-box-sizing: border-box; 13 | -moz-box-sizing: border-box; 14 | box-sizing: border-box; 15 | } 16 | .instagram_feed img.insta-image { 17 | position: absolute; 18 | left: 0; 19 | top: 0; 20 | object-fit: cover; 21 | width: 100%; 22 | height: 100%; 23 | transition: all 0.3s ease 0s; 24 | -webkit-transition: all 0.3s ease 0s; 25 | -moz-transition: all 0.3s ease 0s; 26 | -ms-transition: all 0.3s ease 0s; 27 | -o-transition: all 0.3s ease 0s; 28 | } 29 | .instagram_feed .insta-link { 30 | position: relative; 31 | display: block; 32 | background: #232323; 33 | padding-top: 100%; 34 | } 35 | .instagram_feed .insta-link:hover .insta-image { 36 | opacity: 0.2; 37 | } 38 | -------------------------------------------------------------------------------- /php-curl-instagram-graph.php: -------------------------------------------------------------------------------- 1 |