Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blogger v3 api post图像与php的cotenet_Php_Blogger - Fatal编程技术网

Blogger v3 api post图像与php的cotenet

Blogger v3 api post图像与php的cotenet,php,blogger,Php,Blogger,我正在使用BloggerV3API发布到我的博客 这是一个简单的代码 $mypost = new Google_Post(); $mypost->setTitle("title")); $mypost->setLabels(array('Label1', 'Label2')); $mypost->setContent("some html"); $data = $blogger->posts->insert('000000000000000000

我正在使用BloggerV3API发布到我的博客 这是一个简单的代码

  $mypost = new Google_Post();
  $mypost->setTitle("title"));
  $mypost->setLabels(array('Label1', 'Label2'));
  $mypost->setContent("some html");
  $data = $blogger->posts->insert('0000000000000000000000', $mypost);  
实际上,我想在博客上发布一张图片,我做了一些搜索,似乎可以在博客上发布一张图片,但我找到了一些其他解决方案,比如使用谷歌PicasaAPI

这是我上传图片到谷歌的一些代码

  try {



  $newMediaItems = [];



  //$photosLibraryClient = ......

  $uploadToken = $photosLibraryClient->upload(
  file_get_contents("a.jpg")  ,"name for image"
  );


  $newMediaItems[] =  
  PhotosLibraryResourceFactory::newMediaItem($uploadToken);

  try {
  $batchCreateResponse =
  $photosLibraryClient->batchCreateMediaItems($newMediaItems, ['albumId' 
  => $_SESSION['albumId']]);
  } catch (\Google\ApiCore\ApiException $e) {
  echo $templates->render('error', ['exception' => $e]);
  die();
  }
  } catch (\Google\ApiCore\ApiException $exception) {
  // Error during album creation
  } catch (\Google\ApiCore\ValidationException $e) {
  // Error during client creation
  echo $exception;
  } 
它将一张图片上传到谷歌照片并创建新相册,但我无法检索 图片url(我需要永久url)你知道我怎样才能获得上传到谷歌照片的图片url吗

这是向博主发布图片的正确方式吗