A simple PHP application to upload an image with a caption to an Instagram Business Account using the Instagram Graph API and Cloudinary for image hosting.
- Uploads product images to a Cloudinary account.
 - Publishes the image and caption to an Instagram feed using the Graph API.
 - Provides a simple form for input:
- Product Title
 - Product Description
 - Product Image
 
 - Uses a 
.envfile to securely store API keys and credentials. 
This project uses the following structure:
/your-project-root
|
|-- /form
|   |-- index.php           # The main form for user input
|   |-- post.php            # Handles form submission and API calls
|
|-- /vendor                 # Composer dependencies (auto-generated)
|
|-- .env                    # Environment variables (DO NOT COMMIT)
|-- composer.json           # Project dependencies
|-- README.md               # This file
Before you begin, ensure you have the following:
- An Instagram Business Account connected to a Facebook Page.
 - A Facebook App with the following permissions granted:
instagram_basicpages_show_listinstagram_content_publish
 - The Instagram Graph API enabled in your Facebook App.
 - The following credentials:
- Your Instagram Business Account ID.
 - A non-expiring User Access Token.
 
 - A Cloudinary Account with the following details:
Cloud NameAPI Key&API Secret(for server-side uploads)
 
git clone <your-repository-url>
cd your-project-rootThis project uses vlucas/phpdotenv to manage environment variables and cloudinary/cloudinary_php for image uploads. Install them using Composer.
composer require vlucas/phpdotenv cloudinary/cloudinary_phpThis will create the vendor directory and the composer.json file.
Create a .env file in the root of the project. This file should be added to .gitignore to prevent leaking your credentials.
# Instagram API Credentials
INSTAGRAM_USER_ID=your_instagram_business_account_id
ACCESS_TOKEN=your_permanent_facebook_page_access_token
# Cloudinary Credentials
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret- Navigate to 
http://your-local-domain/form/index.phpin your web browser. - Fill out the form with a title, description, and select an image.
 - Click "Publish to Instagram".
 - The form will submit to 
post.php, which will upload the image to Cloudinary, get the public URL, and then post it to your Instagram account.