【问题标题】:Error in mgp25 while using in laravel to post a photo in Instagram在 laravel 中使用在 Instagram 中发布照片时出现 mgp25 错误
【发布时间】:2018-07-17 19:54:42
【问题描述】:

当我想使用 laravel 中的 mgp25 包将照片上传到 instagram 时,出现无法将值交换为 $photoFilename 的问题 在 : \InstagramAPI\Media\Photo\InstagramPhoto($photoFilename);

更具体地说,我确实收到了响应“输入文件不存在”的错误

【问题讨论】:

  • 你能添加代码吗?

标签: php laravel instagram


【解决方案1】:
 try {
            $ig->login($username, $password);
            echo "login ok \n \n \n";
        } catch (Exception $e) {
            echo 'Something went wrong: ' . $e->getMessage() . "\n \n \n \n";
        }

试试{ $img = public_path($photoFilename);

            $photo = new \InstagramAPI\Media\Photo\InstagramPhoto($img);
            $ig->timeline->uploadPhoto($photo->getFile(), ['caption' => $captionText]);
            echo "publicar \n \n \n \n";
        } catch (Exception $e) {
            echo 'Something went wrong: ' . $e->getMessage() . "\n \n \n ";
        }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-14
    • 2011-11-30
    • 1970-01-01
    • 1970-01-01
    • 2012-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多