2012-06-13 49 views
-1

我在我的程序中使用卷曲。
和我的代码是:收到卷曲请求

$tref = $_GET['tref']; 

$url = "https://paypaad.bankpasargad.com/PaymentTrace"; 
$curl_session = curl_init($url); // Initiate CURL session -> notice: CURL should be enabled. 
curl_setopt($curl_session, CURLOPT_POST, 1); // Set post method on. 
//curl_setopt($curl_session, CURLOPT_FOLLOWLOCATION, 1); // Follow where ever it goes 
curl_setopt($curl_session, CURLOPT_HEADER, 0); //Don't return http headers 
//curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1); // Return the content of the call 
$post_data = "tref=".$tref; 
curl_setopt($curl_session, CURLOPT_POSTFIELDS, $post_data); 

// Get returning data 
$output = curl_exec($curl_session); 
print_r($output); 
print_r($post_data); 

,但是当我在我的主机使用此代码,$output没有设置,当另一台服务器使用此代码正确。
我在我的服务器上如何做。

回答

1

哎发现这个代码:

$data = curl_exec($curl_handle); 
if ($data === FALSE) { 
    die(curl_error($curl_handle)); 
} else { 
    $html_str .= $data; 
} 

一个d,当我使用此代码,我该面对这样的错误:

SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

然后我搜索这个错误,面对这个链接 http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/

和我

之前添加此代码

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_exec():

+1

你可以选择你自己的答案。请这样做,所以社区知道它已经解决了,而有同样问题的人看到它已经解决了。 – 11684

0

确保服务器卷曲使..

变化;extension=php_curl.dll

extension=php_curl.dll 

在php.ini还检查了这Call to undefined function curl_init().?

+0

这是一种禁用它的方法:/ – EaterOfCode

+0

是的,这个扩展名是启用,我可以发送请求的网址,但我无法从网址收到。 – aya