【发布时间】:2016-05-25 03:21:26
【问题描述】:
我有以下 get_file_contents 代码
$opts = array('http' => array(
'method' => 'POST',
'header' => 'Content-type: application/vnd+cbnv+endpoint',
'content' => $encryptedString
));
$buff = @file_get_contents($URL, false, stream_context_create($opts));
如何使用 curl 做到这一点?
我正在尝试这样的事情
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $URL);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $encryptedString);
$ret = curl_exec($handle);
curl_close($handle);
$ret 为 NULL,它应该是我在 @$URL 文件中回显的字符串
谢谢
【问题讨论】: