Để thảo luận và đưa ra ý kiến phản hồi về các sản phẩm của chúng tôi, hãy tham gia kênh Discord chính thức của Google Ads trong máy chủ Cộng đồng quảng cáo và đo lường của Google.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Có hai loại phương thức truyền tải có thể được dùng khi gửi yêu cầu đến API. Thư viện ứng dụng của chúng tôi sẽ chọn một trong những ứng dụng tối ưu sau đây:
Phương án thay thế được dùng khi gRPC không hoạt động: REST. Nó không yêu cầu cài đặt bất kỳ tiện ích PHP nào và dựa trên HTTP/1.1.
Nếu muốn tự chỉ định loại phương thức truyền tải thay vì dựa vào các quy tắc mặc định được mô tả ở trên, bạn có thể đặt thuộc tính transport trong phần CONNECTION của tệp google_ads_php.ini:
[CONNECTION]; Optional transport settings.; By default, "grpc" is used if available otherwise "rest".transport = "grpc"
Ngoài ra, bạn có thể định cấu hình chế độ cài đặt truyền tải theo phương thức lập trình như mọi chế độ cài đặt khác:
$googleAdsClient = (new GoogleAdsClientBuilder()) ... ->withTransport('grpc') ->build();
[null,null,["Cập nhật lần gần đây nhất: 2025-08-27 UTC."],[[["\u003cp\u003eThe Google Ads API client library supports two transport types: gRPC (preferred) and REST (fallback).\u003c/p\u003e\n"],["\u003cp\u003egRPC offers better performance but requires the gRPC PHP extension, while REST is based on HTTP/1.1 and doesn't require any specific extension.\u003c/p\u003e\n"],["\u003cp\u003eYou can manually specify your preferred transport type through the \u003ccode\u003egoogle_ads_php.ini\u003c/code\u003e configuration file or programmatically within your code.\u003c/p\u003e\n"],["\u003cp\u003eThe gRPC version utilized by the library is usually managed through dependencies, primarily \u003ccode\u003egoogle/gax\u003c/code\u003e, and occasionally directly within the library's own \u003ccode\u003ecomposer.json\u003c/code\u003e for optimization or compatibility.\u003c/p\u003e\n"]]],[],null,["# Transport\n\nThere are two types of transport that can be used when sending requests to the\nAPI. Our client library selects the optimal one from the following:\n\n- **Preferred** : [gRPC](https://grpc.io/about/). It requires the [installation\n of the gRPC PHP extension](//grpc.io/docs/quickstart/php/) and it is based on HTTP/2.\n- Alternative used when gRPC is not available: [REST](https://en.wikipedia.org/wiki/Representational_state_transfer). It does not require the installation of any PHP extension and it is based on HTTP/1.1.\n\nIf you prefer to specify the transport type yourself instead of relying on\nthe default rules described above, you can set the `transport` property in the\n`CONNECTION` section of your\n[`google_ads_php.ini`](https://github.com/googleads/google-ads-php/blob/HEAD/examples/Authentication/google_ads_php.ini)\nfile: \n\n [CONNECTION]\n ; Optional transport settings.\n ; By default, \"grpc\" is used if available otherwise \"rest\".\n transport = \"grpc\"\n\nAlternatively, you can configure the transport setting programmatically like\nevery other ones: \n\n $googleAdsClient = (new GoogleAdsClientBuilder())\n ...\n -\u003ewithTransport('grpc')\n -\u003ebuild();\n\n| **Key Point:** Typically, the grpc version that this PHP library relies on is transitively specified in [`composer.json`](https://github.com/googleapis/gax-php/blob/master/composer.json) of `google/gax`, which is one of the core dependencies. In some cases, we may specify the protobuf version directly in [`composer.json`](https://github.com/googleads/google-ads-php/blob/HEAD/composer.json) of the PHP library, for better performance or for compatibility."]]