简体   繁体   English

在服务器PHP中上传后,cURL开发加载缓慢

[英]cURL development load slowly after uploaded in server PHP

Hi "I would like to ask an assistance" yes, you read it right, I don't know what's happening to my cURL development program. 嗨, “我想寻求帮助”是的,您没看错,我不知道我的cURL开发程序正在发生什么。 Straight to the point, I have cURL development program which works perfect and faster in my localhost xampp, I even receives a response correctly. 直截了当,我有一个cURL开发程序,该程序在localhost xampp中可以完美,更快地运行,我什至可以正确接收响应。 But I thought i'm done on my work, until I uploaded it to my cpanel, It became superslow in terms loading, It cannot receives any response anymore also after loading. 但是我以为我已经完成了我的工作,直到将其上传到我的cpanel为止,它在加载方面变得非常慢,在加载之后也无法再收到任何响应。

I just receive Curl Error: 7 我刚收到Curl Error: 7

OR 要么

Curl Error: 28

I don't know whats this weird thing. 我不知道这奇怪的事情是什么。 I googled already the errors ( cURL error(7) "It says connection issue to host, but its impossible, I can connect to host in my localhost." cURL error: 28 I have made some adjustment also to my curl_opt() you see in my comment below. 我已经在错误中进行了搜索( cURL error(7) “它说到主机的连接问题,但它不可能,我可以在本地主机中连接到主机。” cURL error: 28我也对我的curl_opt()进行了一些调整在下面的评论中

Here's my code 这是我的代码

$headers = array(
                // "Accept-Encoding: gzip, deflate",
                "Content-Type: text/xml;charset=\"UTF-8\"",
                "SOAPAction: \"http://domain.org/\"",
                "Host: domain.com",
                "Content-length: ".strlen($xml_post_string),
                ); 

$url = $soapUrl;

// PHP cURL  for https connection with auth
$soap_do = curl_init() or die('Error');
set_time_limit(0);
curl_setopt($soap_do, CURLOPT_URL,            $url);
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($soap_do, CURLOPT_TIMEOUT,        400);
curl_setopt($soap_do, CURLOPT_AUTOREFERER,    true); // try, to solve an issue
curl_setopt($soap_do, CURLOPT_MAXREDIRS,      10);   // try, to solve an issue
curl_setopt($soap_do, CURLOPT_FOLLOWLOCATION, true); // try, to solve an issue
curl_setopt($soap_do, CURLOPT_TIMEOUT_MS,     400);  // try, to solve an issue
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST,           true );            
curl_setopt($soap_do, CURLOPT_POSTFIELDS,     $xml_post_string); 
curl_setopt($soap_do, CURLOPT_VERBOSE,        TRUE); 
curl_setopt($soap_do, CURLOPT_HTTPHEADER,     $headers);

But still the same, No response coming and loads slow 但还是一样,没有响应,加载速度也很慢

Whenever I run into problems with cURL, I place the curl handle that has just completed to PHP's curl_getinfo function. 每当我遇到cURL问题时,我都会将刚刚完成的curl句柄放在PHP的curl_getinfo函数中。

Try adding this code just after you run curl_exec($soap_do); 运行curl_exec($soap_do);之后,尝试添加此代码curl_exec($soap_do);

echo '<pre>'; print_r(curl_getinfo($soap_do)); echo '</pre>';

curl_getinfo returns an array of data, which is displayed by print_r, and formatted in an easy to read list by the <pre> tag. curl_getinfo返回一个数据数组,该数组由print_r显示,并由<pre>标记格式化为易于阅读的列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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