PHP 5는 지원이 종료되었으며 2026년 1월 31일에 지원 중단됩니다. 지원 중단 후에는 조직에서 이전에 조직 정책을 사용하여 레거시 런타임의 배포를 다시 사용 설정한 경우에도 PHP 5 애플리케이션을 배포할 수 없습니다. 기존 PHP 5 애플리케이션은 지원 중단 날짜 이후에도 계속 실행되고 트래픽을 수신합니다. 지원되는 최신 PHP 버전으로 마이그레이션하는 것이 좋습니다.
REGION_ID는 앱을 만들 때 선택한 리전을 기준으로 Google에서 할당하는 축약된 코드입니다. 일부 리전 ID는 일반적으로 사용되는 국가 및 주/도 코드와 비슷하게 표시될 수 있지만 코드는 국가 또는 주/도와 일치하지 않습니다. 2020년 2월 이후에 생성된 앱의 경우 REGION_ID.r이 App Engine URL에 포함됩니다. 이 날짜 이전에 만든 기존 앱의 경우 URL에서 리전 ID는 선택사항입니다.
App Engine은 URL Fetch 서비스를 사용하여 아웃바운드 HTTP(S) 요청을 실행합니다.
요청 크기 한도와 URL Fetch 요청을 통해 전송되는 헤더에 대한 자세한 내용은 아웃바운드 요청을 참조하세요.
HTTP 요청 전송
PHP 언어는 원격 HTTP 요청을 수행하기 위한 여러 함수를 제공합니다.
이러한 함수는 Google App Engine에서 다양한 방식으로 구현되며, 서로 다른 할당량과 비용이 적용됩니다.
스트림 핸들러: 기본 http:// 및 https:// PHP 스트림 핸들러는 App Engine의 URL Fetch 서비스를 사용하여 HTTP 요청을 수행하도록 구성됩니다. file_get_contents()와 같은 많은 PHP 함수는 스트림 핸들러를 간접적으로 사용하며, 따라서 URL Fetch 서비스도 사용합니다.
cURL 'lite': cURL 'lite'는 소켓 서비스 대신 URL Fetch 서비스를 사용하는 cURL 라이브러리의 Google 제공 버전입니다. 애플리케이션의 php.ini 파일에서 cURL 'lite'를 사용 설정해야 합니다.
cURL 확장의 다음 메서드는 지원되지 않습니다.
함수 curl_multi_*개
비 표준 프로토콜 지원
80(HTTP) 또는 443(HTTPS) 이외의 포트 지원
cURL, cURL Lite 또는 스트림 래퍼 사용 여부 결정은 주로 애플리케이션과 선호도에 따라 다릅니다. 정확히 모르겠으면 Guzzle HTTP 라이브러리를 사용합니다. Guzzle은 HTTP 요청의 추상 계층을 제공하며, 사용자는 이를 통해 애플리케이션 코드를 다시 작성하지 않고 기본 서비스를 변경할 수 있습니다.
스트림 핸들러
표준 HTTP(S) 스트림 핸들러는 fopen(), file_get_contents() 등의 기본 제공 PHP 함수에 사용됩니다.
URL Fetch를 사용하는 경우 기본 URL Fetch 서비스는 기본적으로 최대 5개의 리디렉션을 따릅니다. 이러한 리디렉션은 승인 헤더와 같은 민감한 정보를 리디렉션된 대상으로 전달할 수 있습니다. 앱에 HTTP 리디렉션이 필요하지 않으면 리디렉션을 사용 중지하는 것이 좋습니다.
리디렉션을 따르지 않도록 URL Fetch 서비스에 지시하려면 앱이 HTTP 컨텍스트 옵션의 follow_location 매개변수를 false로 설정해야 합니다.
HTTPS 요청 전송
기본 URL Fetch 서비스는 기본적으로 연결 중인 호스트의 인증서를 검증하고, 인증서가 일치하지 않으면 요청을 거부합니다. 요청을 명시적으로 보호할 필요는 없습니다.
호스트 인증서 검증 사용 중지
기본적으로 HTTPS 래퍼의 App Engine 구현은 호스트 인증서의 유효성 검사를 시도하고 인증서가 일치하지 않으면 요청을 거부합니다. 이 동작을 사용 중지하려면 SSL/TLS 컨텍스트 옵션에서 verify_peer 값을 false로 설정합니다.
다른 App Engine 앱으로 요청 전송
다른 App Engine 앱에 요청을 전송하는 경우 App Engine 앱은 요청에 X-Appengine-Inbound-Appid 헤더를 추가하여 자신의 ID를 입증해야 합니다.
URL Fetch 서비스에 리디렉션을 따르지 않도록 지시하면 App Engine이 헤더를 요청에 자동으로 추가합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThe \u003ccode\u003eREGION_ID\u003c/code\u003e is a Google-assigned code based on the region selected during app creation, included in App Engine URLs for apps created after February 2020, but it does not directly correspond to specific countries or provinces.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine uses the URL Fetch service to handle outbound HTTP(S) requests, and PHP offers stream handlers, the cURL extension, and cURL "lite" for making these requests, each with different implementations and associated quotas.\u003c/p\u003e\n"],["\u003cp\u003eStream handlers use the URL Fetch service, the cURL extension uses the Sockets service (requiring billing to be enabled), and cURL "lite" is a Google-supplied version of the cURL library that also uses the URL Fetch service, and certain functions are unsupported.\u003c/p\u003e\n"],["\u003cp\u003eGuzzle HTTP library is recommended as it provides an abstraction layer for HTTP requests, enabling switching between services without code rewrites, and it uses stream handlers or cURL handlers based on availability.\u003c/p\u003e\n"],["\u003cp\u003eDisabling redirects is recommended for enhanced security, and if an app sends requests to another App Engine app, it must include the \u003ccode\u003eX-Appengine-Inbound-Appid\u003c/code\u003e header to assert its identity.\u003c/p\u003e\n"]]],[],null,["Region ID\n\nThe \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e is an abbreviated code that Google assigns\nbased on the region you select when you create your app. The code does not\ncorrespond to a country or province, even though some region IDs may appear\nsimilar to commonly used country and province codes. For apps created after\nFebruary 2020, \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r` is included in\nApp Engine URLs. For existing apps created before this date, the\nregion ID is optional in the URL.\n\nLearn more\n[about region IDs](/appengine/docs/legacy/standard/php/how-requests-are-routed#region-id). \nOK\n\nThis page describes how to issue HTTP(S) requests from your App Engine\napp.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| php-gen2\n|\n| /services/access). If you are updating to the App Engine PHP 7/8 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/php-differences) to learn about your migration options for legacy bundled services.\nApp Engine uses the URL Fetch service to issue outbound HTTP(S) requests. For details on request size limits and which headers are sent in a URL Fetch request, see [Outbound Requests](/appengine/docs/legacy/standard/php/outbound-requests).\n\nIssue an HTTP request\n\nThe PHP language provides several functions for making remote HTTP requests.\nThese are implemented in different ways in Google App Engine, and are subject to\ndifferent quotas and costs:\n\n- **Stream handlers** : The native `http://` and `https://` PHP stream handlers are configured to use App Engine's [URL Fetch service](/appengine/docs/legacy/standard/php/issue-requests) to make HTTP requests. Many PHP functions such as [file_get_contents()](http://php.net/manual/en/function.file-get-contents.php) use stream handlers indirectly, and thus also use the URL Fetch service.\n- **cURL extension** : The [cURL\n extension](http://php.net/manual/en/book.curl.php) uses the [Sockets service](/appengine/docs/legacy/standard/php/sockets). The cURL extension [must be enabled](/appengine/docs/legacy/standard/php/runtime#dynamically_loadable_extensions) in your application's [php.ini file](/appengine/docs/legacy/standard/php/config/php_ini) and billing must be enabled for your project.\n- **cURL \"lite\"** : cURL \"lite\" is a Google-supplied version of the cURL library that uses the [URL Fetch service](/appengine/docs/legacy/standard/php/issue-requests) instead of the Sockets service. You must enable cURL \"lite\" in your application's [php.ini file](/appengine/docs/legacy/standard/php/config/php_ini#GAE_directives). The following methods of the cURL extension are not supported:\n - `curl_multi_*` functions\n - support for non-standard protocols\n - support for ports other than 80 (HTTP) or 443 (HTTPS)\n\nDeciding whether to use cURL, cURL Lite, or stream wrappers depends largely on\nyour application and preference. If you are unsure, use the\n[Guzzle HTTP library](http://docs.guzzlephp.org/en/latest/index.html). Guzzle\nprovides an abstraction layer for HTTP requests, which allows you to change\nthe underlying service without rewriting application code. \n\nStream handlers\n\nThe standard HTTP(S) stream handlers are used in built-in PHP\nfunctions such as `fopen()` and `file_get_contents()`.\n\n\n $url = 'http://httpbin.org/post?query=update';\n $data = [\u003e'data' = &\u003e#39;this', 'data2' = 'that'];\n $headers = \"accept: */*\\r\\n\" .\n \"Content-Type: application/x-www-form-urlencoded\\r\\n\" .\n \"Custom-Header: custom-value\\r\\n\" .\n \u003e \"Custom-Heade\u003er-Two: custom-value-2\\r\\n&q\u003euot;;\n\n $context = [\n 'h\u003ettp' = [\n 'method' = 'POST',\n 'header' = $headers,\n 'content' = http_build_query($data),\n ]\n ];\n $context = stream_context_create($context);\n $result = file_get_contents($url, false, $context);\n\ncURL and cURL \"lite\"\n\n\nEnable cURL or cURL \"lite\" in php.ini to use cURL functions for outbound\nrequests. cURL \"lite\" uses the [URL Fetch service](/appengine/docs/legacy/standard/php/issue-requests),\nwhile cURL uses the [Sockets API](/appengine/docs/legacy/standard/php/sockets) \n\n $url = 'http://httpbin.org/post?query=update';\n $data = [\u003e'data' = &\u003e#39;this', 'data2' = 'that'];\n $headers = [\n 'Accept: */*',\n 'Content-Type: application/x-www-form-urlencoded',\n 'Custom-Header: custom-value',\n 'Custom-Header-Two: custom-value-2'\n ];\n\n // open connectio\u003en\n $ch = curl_init();\n\n // \u003eset curl options\n $options = [\n CURLO\u003ePT_URL = $url,\n CURLOPT_POST = count($data),\n \u003e CURLOPT_POSTFIELDS = http_build_query\u003e($data),\n CURLOPT_HTTPHEADER = $headers,\n CURLOPT_RETURNTRANSFER = true,\n ];\n curl_setopt_array($ch, $options);\n\n // execute\n $result = curl_exec($ch);\n\n // close connection\n curl_close($ch);\n\nGuzzle\n\nBy default, Guzzle uses PHP's stream handler, but will automatically use a\ncURL handler if cURL or cURL \"lite\" is enabled. \n\n $url = 'http://httpbin.org/post?query=update';\n $data = [\u003e'data' = &\u003e#39;this', 'data2' = '\u003e;that'];\n $headers = [\n \u003e 'Accept' = '*/*',\n 'Content-Type\u003e39; = 'application/x-www-form-urlencod\u003eed',\n 'Custom-Header' = 'custom-value',\n 'Custom-Header-Two' = 'custom-value',\n ];\n\n $guzzle = new GuzzleHttp\\Client;\n $re\u003equest = new GuzzleHttp\\Psr7\\Request('POST', $url, $headers, http_build_query($data));\n $result = $guzzle-send($request);\n\nSet a request timeout\n\nUse the `timeout` option in\n[HTTP context](https://php.net/manual/en/context.http.php) to alter\nthe deadline.\n\nDisable redirects **Important:** To improve the security of your app, it is recommended that you disable redirects.\n\nIf you are using URL Fetch, the underlying URL Fetch service follows up to five\nredirects by default. These redirects could forward sensitive information, such\nas authorization headers, to the redirected destination. If your app does not\nrequire HTTP redirects, it is recommended that you disable the redirects.\n\nTo instruct the URL Fetch service to not follow redirects, your app must\nset the `follow_location` parameter in the\n[HTTP context options](https://php.net/manual/en/context.http.php)\nto `false`.\n\nIssue an HTTPS request\n\nBy default, the underlying URL Fetch service validates the certificate\nof the host it contacts, and rejects requests if the certificate\ndoesn't match. You don't need to explicitly secure your request.\n\nDisable host certificate validation\n\nBy default, the App Engine implementation of the HTTPS wrapper attempts\nto validate the certificate of the host, and rejects requests where the\ncertificate does not match. To disable this behavior, set the value of\n`verify_peer` to `false` in the\n[SSL/TLS context options](https://php.net/manual/en/context.ssl.php).\n| **Note:** The URL Fetch service ignores all other SSL/TLS context options.\n\nIssue a request to another App Engine app\n\nWhen issuing a request to another App Engine app, your App Engine app\nmust assert its identity by adding the header `X-Appengine-Inbound-Appid`\nto the request.\nIf you instruct the URL Fetch service to not follow redirects, App Engine\nwill add this header to requests automatically.\n\nSee [Disabling redirects](#disabling_redirects) for guidance on disabling\nredirects.\n| **Note:** If you are making requests to another App Engine application, use its \u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com` domain name rather than a custom domain for your app.\n\nWhat's next\n\nLearn about the URL Fetch service, such as the headers that are\nsent in a URL Fetch request in [Outbound Requests](/appengine/docs/legacy/standard/php/outbound-requests)."]]