如何转换CURLOPT_FILE for Google AppEngine?

时间:2014-11-12 18:52:30

标签: php file google-app-engine curl

由于在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");

1 个答案:

答案 0 :(得分:1)

您需要将文件写入Google云端存储。像

这样的东西
$in = "http://example.com/external.php";
$out = "gs://bucket/internal.php";

file_put_contents($out, file_get_contents($in));