2011-08-19 146 views
0

我使用cURL为客户创建了一个API。我刚搬到一个新的服务器这个域,现在的API不起作用。似乎一切工作都很好模块明智,但我不能得到它的工作:cURL在此服务器上未找到请求的URL /api/process.php

这是我得到的回应。

Array ( 
[url] => https://www.1800pay.com/api/process.php 
[content_type] => text/html; charset=iso-8859-1 
[http_code] => 404 
[header_size] => 179 
[request_size] => 506 
[filetime] => -1 
[ssl_verify_result] => 0 
[redirect_count] => 0 
[total_time] => 0.038607 
[namelookup_time] => 0.002688 
[connect_time] => 0.002737 
[pretransfer_time] => 0.038372 
[size_upload] => 0 
[size_download] => 294 
[speed_download] => 7615 
[speed_upload] => 0 
[download_content_length] => 294 
[upload_content_length] => 0 
[starttransfer_time] => 0.038597 
[redirect_time] => 0) 
Curl error: 

Not Found 

The requested URL /api/process.php was not found on this server. 

Apache/2.2.3 (CentOS) Server at www.1800pay.com Port 443 

代码中使用:

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, "https://www.1800pay.com/api/process.php"); 
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); 
curl_setopt($ch, CURLOPT_TIMEOUT, 15); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
//curl_setopt($ch, CURLOPT_VERBOSE, true); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $output_transaction); 
curl_setopt($ch, CURLOPT_POST, 1); 

if (!($data = curl_exec($ch))) {print_r(curl_error($ch));echo "error"; 
return ERROR; 
} 
print_r(curl_getinfo($ch)); 
echo 'Curl error: ' . curl_error($ch); 
curl_close($ch); 

print_r($data); 

感谢您的帮助:) 是的文件存在于服务器.....:|

+0

Curl正在尝试44?或者在复制粘贴时错过了3个? – Alex

+0

粘贴pb我会修复该问题,谢谢 – Outcast

+0

1800pay.com解决适当的IP?你已禁用SSL验证,所以你可以连接到几乎任何服务器。同样,检查服务器的错误日志,它会说明它试图检查process.php文件的目录。 –

回答

0

答案在响应内..一个未发现的错误就是这样。只要确保文件api/process.php存在于新域中即可。

+0

谢谢,但该文件位于服务器上,并位于代码提及的地方:)。 – Outcast

0

我不知道你的问题是什么,但是当我尝试使用卷曲的网址是:

function curl_get($url) 
    { 
     $curl_handle = curl_init(); 
     curl_setopt($curl_handle, CURLOPT_URL, $url); 
     curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); 
     curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE); 
     curl_setopt($curl_handle, CURLOPT_COOKIEJAR, "cookie.txt"); 
     curl_setopt($curl_handle, CURLOPT_COOKIEFILE, "cookie.txt"); 
     //curl_setopt($curl_handle, CURLOPT_USERPWD, $co.":".$apikey); 
     curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); 
     curl_setopt($curl_handle, CURLOPT_DNS_USE_GLOBAL_CACHE, FALSE); 
     $buffer = curl_exec($curl_handle); 
     $error = curl_error($curl_handle); 
     curl_close($curl_handle); 
     //if (empty($buffer)) 
      //echo "No response from server: ".$error; 
     //else 

     return $buffer; 
    } 

我得到这个:

错误[代码:1043]付款()键 - 错误的数据

+0

是的,这是正常的,因为我没有给你的API密钥上面有帐户信息。但是,如果你得到了答案,这意味着API工作并找到该文件,但在服务器上运行该PHP脚本本身不起作用。有趣。 – Outcast

+0

也许尝试删除HEADER,0子句? –

+0

是你的output_transaction一个关联数组吗? –

相关问题