如何转换CURLOPT_FILE for Google AppEngine?

问题描述 投票:0回答:1

由于在Google AppEngine上不允许CURL和文件写入,我需要帮助来转换以下CURL请求,以便可以在其上运行:

$ch = curl_init("http://example.com/external.php");
$fp = fopen("internal.php", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);

fclose($fp);
header("Location:internal.php");
php file google-app-engine curl
1个回答
1
投票

您需要将文件写入谷歌云存储。所以像

$in = "http://example.com/external.php";
$out = "gs://bucket/internal.php";

file_put_contents($out, file_get_contents($in));
© www.soinside.com 2019 - 2024. All rights reserved.