2

I use Instagram-API for the posting images with captions. I try:

$ig->timeline->uploadPhoto($photo->getFile(), ["caption" => "Hello world!"]);

The request is completed, the image is successfully uploaded, but the caption is empty.

When I run the example uploadPhoto.php, the image is also loaded without a title.

How can I fix that?

4

1 回答 1

0
$photoFilename = Enter Path here;

$photo = new \InstagramAPI\Media\Photo\InstagramPhoto($photoFilename);

$captionText = 'Hello world!';

$ig->timeline->uploadPhoto($photo->getFile(), ['caption' => $captionText]);

运行此代码,它可以正常工作。

如果出现任何问题,请将您的代码发送给我,我会更正它。

于 2018-09-28T06:10:03.923 回答