doulingqiu4349 2014-09-15 08:42
浏览 102
已采纳

php curl_exec死掉并退出脚本并显示白屏

this is my code: when i try to connect to whm/Cpanel to add new account this issue occure but when i try to delete a user from whm/cpanel it works perfect. my problem is curl_exec line die and show me blank white screen there isn't any error on the page and curl_error didn't return anything codes after curl_exec didn't run at all.

Thanks for your answers

$curl = curl_init();
# Create Curl Object
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
# Allow certs that do not match the domain
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
# Allow self-signed certs
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
# Return contents of transfer on curl_exec
$header[0] = "Authorization: WHM $cpanel_user:" . preg_replace("'(|
)'", "", $whmhash);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 1800);
# Remove newlines from the hash
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
# Set curl header
curl_setopt($curl, CURLOPT_URL, $command);
# Set your URL
curl_setopt($curl, CURLOPT_FAILONERROR, FALSE);

curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
if( ! $result = curl_exec($curl))
{
    trigger_error(curl_error($curl));
} 

$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
# Execute Query, assign to $result
if ($result == false) {
    error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $query");
}
curl_close($curl);
  • 写回答

2条回答 默认 最新

  • duanmen1887 2015-01-04 22:07
    关注

    The problem was nginx that didn't allow the response came back to my code. by disabling nginx on server that working on proxy mode for apache it solved.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用