New Automated Posting API library from NextScripts can automatically share images from your site directly to your Instagram account.
API can make images square by cropping or expanding them. You can also add text with hashtags to every image.
How to use it – Let’s see some code:
$login = ‘YourInstagramUserName’;
$pass = ‘YourInstagramPassword’;
$msg = ‘Post this to Instagram! #testpost, #snap’;
$imgURL = ‘http://www.YourWebsiteURL.com/link/to/your/image.jpg’;
$imgFormat = ‘E’; // ‘E’ (Extended) or ‘C’ (Cropped) or ‘U’ (Untouched)
$nt = new nxsAPI_IG();
$loginError = $nt->connect($email, $pass);
$result = $nt -> post($msg, $imgURL, $imgFormat);
else echo $loginError;
if (!empty($result) && is_array($result) && !empty($result[‘post_url’]))
echo ‘<a target=”_blank” href=”‘.$result[‘post_url’].'”>New Post</a>’;
echo “<pre>”.print_r($result, true).”</pre>”;
Get SNAP API
NextScripts Premium API for WordPress and PHP provides an ability to autopost to social networks without native built-in APIs.
NextScripts Universal API for PHP provides a unified API interface for autoposting to more then 25 different social networks including Google+, Pinterest, Flipboard, Reddit, YouTube, Blogger, and LinkedIn Company Pages as well as Facebook, Twitter, Tumblr, Flickr, ScoopIt and many others.
PHP Ver > 5.2 (PHP 7 or 7.1 is recommended)
PHP should have at least 32M of memory (64M and more is highly recommended).
gzip and mbstring are not required but will make things work faster.
Image is extended by the longer side to make it square. The whole image will be seen in the stream and in the full view. In the stream image will appear smaller.
Image is cropped to make it square. Some parts of the image will be permanently removed.
Image is untouched. Instagram will crop image for the stream. Could cause “Uploaded image isn’t in an allowed aspect ratio” Error