PHP的卷曲在线服务器无法正常工作 [英] Php Curl live server not working

查看:141
本文介绍了PHP的卷曲在线服务器无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我测试在我的本地脚本,它完美地工作。我想我活的服务器上,并没有工作。

I test the script on my localhost and it working perfectly. I tried on my the live server and it didn't work.

<?php
   $uploadfile=dirname(__FILE__)."/xml_request/cat.xml"; 
   $ch = curl_init("http://remote.xxxxxxxxxx.com.au:8090/Options.API");   
   curl_setopt($ch, CURLOPT_POSTFIELDS,
               array('Request'=>"@$uploadfile",
                     'clientKey'=>'xxxxxxxxxxxxxxxxxxx'));
   curl_setopt($ch, CURLOPT_PORT, '8090');
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   $postResult = curl_exec($ch);

   $response = curl_getinfo($ch);
   echo "<pre>";
   print_r($response);
   echo "</pre>";

   curl_close($ch);
   echo "<pre>";
   print_r($postResult);
   //file_put_contents(dirname(__FILE__).'/xml_record/live.xml', $postResult);

?>

本地主机
我的print_r的curl_getinfo($ CH)。

Localhost I print_r the curl_getinfo($ch).

Array
(
    [url] => http://remote.xxxxxxxx.com.au:8090/Options.API
    [content_type] => text/html; charset=utf-8
    [http_code] => 200
    [header_size] => 246
    [request_size] => 215
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 2.278
    [namelookup_time] => 0
    [connect_time] => 0.344
    [pretransfer_time] => 0.344
    [download_content_length] => 9376
    [upload_content_length] => 759
    [starttransfer_time] => 0.734
    [redirect_time] => 0
    [certinfo] => Array
        (
        )

    [redirect_url] => 
)

现场试
我的print_r的curl_getinfo($ CH)。

Live test I print_r the curl_getinfo($ch).

 Array
    (
        [url] => http://remote.xxxxxxxxxxx.com.au:8090/Options.API
        [content_type] => 
        [http_code] => 0
        [header_size] => 0
        [request_size] => 0
        [filetime] => -1
        [ssl_verify_result] => 0
        [redirect_count] => 0
        [total_time] => 0.012024
        [namelookup_time] => 0.011809
        [connect_time] => 0
        [pretransfer_time] => 0
        [download_content_length] => -1
        [upload_content_length] => -1
        [starttransfer_time] => 0
        [redirect_time] => 0
    )

不知道,如果URL的端口有问题。我试图寻找解决这个问题,但没有运气。

Not sure if the port of the url is the problem. I try to search to solve the problem but no luck.

推荐答案

从评论:

您的虚拟主机提供商可能是端口阻止出站流量8090多块主机管理为增加安全性不常见的端口。为了得到这个解决的唯一途径是联系您的虚拟主机,并要求他们取消阻止该端口,使您可以将其连接。

Your webhost is probably blocking outbound traffic on port 8090. Many webhosts block uncommon ports for added security. The only way to get this resolved is to contact your webhost and ask them to unblock the port so that you can connect on it.

这篇关于PHP的卷曲在线服务器无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆