简体   繁体   中英

php - How to enable php://input stream wrapper for curl

I was trying to do the following

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"php://input" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
$result=curl_exec ($ch);
echo curl_error($ch);
echo $result;

to get raw post data using curl because my hosting com disabled all socket functions except curl so i cannot do file_get_contents("php://input");

i get an error like

Protocol php not supported or disabled in libcurl1

what shall i do?

您不需要套接字函数来访问php://input ,它可以通过标准fopen访问,如果您的托管公司阻止fopen那么您应该考虑更改提供程序而不是代码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM