Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Curl调用失败_Php_Curl_Response_Libcurl - Fatal编程技术网

Php Curl调用失败

Php Curl调用失败,php,curl,response,libcurl,Php,Curl,Response,Libcurl,我正在进行以下php curl调用: $installScript = curl_init('http://blah.com'); curl_setopt($installScript, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($installScript, CURLOPT_POST, 1); curl_setopt($installScript, CURLOPT_POSTFIELDS, "user=" . $_POST['user

我正在进行以下php curl调用:

$installScript = curl_init('http://blah.com');
    curl_setopt($installScript, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($installScript, CURLOPT_POST, 1);
    curl_setopt($installScript, CURLOPT_POSTFIELDS, "user=" . $_POST['user'] . "&password=" . $_POST['password']);
    curl_setopt($installScript, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($installScript, CURLOPT_HEADER, 0);
    curl_setopt($installScript, CURLOPT_RETURNTRANSFER, 1);
    $canUninstall = curl_exec($installScript);
    curl_close($installScript);

由于某些问题,此调用似乎间歇性失败。

不确定您使用的用户名或密码类型,但您应该对其进行url编码

curl_setopt($installScript, CURLOPT_POSTFIELDS, "user=" . urlencode($_POST['user']) . "&password=" .  urlencode($_POST['password']));

您收到的错误消息是什么?如果post参数未编码,curl调用是否会失败?如果某人的密码中有特殊字符,则会使其失败。特殊字符,例如?&(或大多数非字母数字字符)。即使使用普通字符,也会失败