cURL Requested URL /api/process.php was not found on this server

青春壹個敷衍的年華 提交于 2020-01-11 14:08:11

问题


I created an API for customers using cURL. I just moved to a new server this domain and now the api doesnt not work. Everything seems to be working fine modules wise but I can't get it to work:

This is the response I get.

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

CODE USED:

$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);

Thanks for the help :) And YES THE FILE EXISTS ON THE SERVER..... :|


回答1:


The answer is within the response.. a not found error is exactly that. Just make sure the file api/process.php exists on the new domain.




回答2:


I'm not sure what your problem is but when I try to curl the URL using this:

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;
    }

I get this:

Error [Code:1043] Payment ()Key - incorrect data



来源:https://stackoverflow.com/questions/7127460/curl-requested-url-api-process-php-was-not-found-on-this-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!