Build Pinterest Bot With PHP: Followers
Next step in promoting our blog on Pinterest is to follow popular accounts in our niche. Pinterest Bot for PHP library provides this functionality for us.
I’m not going to cover installation and setup of the library here. You can find it in the documentation; I consider that you have already installed it and you are ready to go. So, we start.
Firstly we need to select people we are interested in. Very easy. If we are interested in people who have a lot of pins about cats, we can simple search for these people like this:
Here you can find more info about
search
method. Notice, that to search for pinners you should be logged in.
Nice! Now $peopleToFollow
variable stores an array of users data. We can loop through this array and call follow
method for every user. We need only user’s id to follow:
Done! We have subscribed to all these people.
If you have posted many pictures likely you already have some subscribers. It will be nice if we also can subscribe to them. To do this we need:
- Receive all our followers.
- Follow them.
Again, very easy, Several lines of code. We need to replace search
method line with followers
method.
Done! Now we loop through our followers and subscribe to them. Followers is a nice way to expand a social net for our account, so more and more people will view our pins and visit our blog.
You can find examples from this article on GitHub.
Previous articles: