我正在尝试在https://salesgenie.com/brandingservice/details?url=att.salesgenie.com对 .NET RESTful Web 服务进行简单的调用 进行 cURL 调用的测试页面位于https://test -cms.salesgenie.com/wp-content/themes/salesgenie/branding-proxy.php 可以在浏览器中调用 Web 服务,但通过 cURL 调用时会超时。以下是 branding-proxy.php 页面中的代码:
if (!function_exists('curl_init')){
die('Sorry cURL is not installed!');
}
$url = 'https://salesgenie.com/brandingservice/details?url=att.salesgenie.com';
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($handle, CURLOPT_SSLVERSION,3);
$response = curl_exec($handle);
$code = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
setcookie('CmsCookie', $code . ' ' . $response, 0, '/', 'salesgenie.com', 0);
echo 'Code:' . $code."<br />Response: ".$response;