You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过PHP实现从自有网站向Google+账户自动发布动态?

PHP实现Google+自动发布的关键说明

Hey there, let's clear up the core issue first—Google+ consumer (personal) accounts no longer support automated content publishing via API. Google shut down the public Google+ API for regular users back in 2019, along with most consumer-facing Google+ features. Unlike Twitter and Facebook, which still maintain active APIs for automated posting, there's no official or legitimate way to auto-post to a personal Google+ account anymore.

What are your alternatives?

If you're looking for a Google ecosystem replacement for automated content sharing, here are two practical options:

  • Google Business Profile API (formerly Google My Business): If this is for a business, brand, or local store, this API lets you auto-post updates, offers, and announcements to your business profile. It's the closest equivalent for business-focused content that would have gone to Google+.
  • Google Blogger API: For personal content, you can auto-post to a Blogger blog using PHP, then share those posts across Google's other services (like Google Search, or via your Google Account) if needed.

Example code for Google Business Profile (PHP)

If you go the business profile route, here's a quick snippet to get you started using Google's official PHP client library:

  1. First, set up a project in the Google Cloud Console, enable the Google Business Profile API, and create a service account with the right permissions.
  2. Install the client library via Composer: composer require google/apiclient:^2.0
  3. Then use this code structure:
require __DIR__ . '/vendor/autoload.php';

// Initialize Google Client
$client = new Google\Client();
$client->setApplicationName('Business Profile Auto-Poster');
$client->setScopes([Google\Service\MyBusinessBusinessInformation::MYBUSINESS_BUSINESS_INFORMATION]);
$client->setAuthConfig('path/to/your-service-account-key.json');
$client->setAccessType('offline');

// Create service instance
$service = new Google\Service\MyBusinessBusinessInformation($client);

// Build your post
$localPost = new Google\Service\MyBusinessBusinessInformation\LocalPost();
$localPost->setSummary('Check out our new product launch!');
$localPost->setCallToAction(new Google\Service\MyBusinessBusinessInformation\CallToAction([
    'actionType' => 'SHOP_NOW',
    'url' => 'https://your-website.com/product'
]));

// Publish the post (replace placeholders with your account/location IDs)
$parent = 'accounts/your-business-account-id/locations/your-location-id';
$response = $service->accounts_locations_localPosts->create($parent, $localPost);

// Verify success
if ($response->getName()) {
    echo "Post published successfully: " . $response->getName();
}

Just a heads-up: To use the Google Business Profile API, you'll need to verify your business and get access approved by Google—this isn't an open API for all users.

内容的提问来源于stack exchange,提问作者zozodev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 07:04:29