Unable to make php curl request with port number

后端 未结 6 783
一生所求
一生所求 2020-12-06 17:23

I am unable to make a php curl request with port number , without port number i am getting response properly.

Through terminal when i do curl http://www.sample.com

相关标签:
6条回答
  • 2020-12-06 17:26

    Add

    curl_setopt($ch, CURLOPT_PORT, 8088);
    

    Curl_setopt reference

    0 讨论(0)
  • 2020-12-06 17:35

    Try to set

    curl_setopt($ch,CURLOPT_PORT, 8088);
    

    See more info http://php.net/manual/en/function.curl-setopt.php

    0 讨论(0)
  • 2020-12-06 17:36

    Try to set the port like this:

    curl_setopt($ch, CURLOPT_PORT, $_SERVER['SERVER_PORT']);
    

    or:

    curl_setopt($ch, CURLOPT_PORT, 8088);
    
    0 讨论(0)
  • 2020-12-06 17:43

    Make sure that the port 8080 is enabled in Cent OS

    and try this curl_setopt($ch, CURLOPT_PORT, 8088);

    0 讨论(0)
  • 2020-12-06 17:43

    I went to server admin with this problem and he changed configuration in centos

    in folder /etc/sysconfig/

    he edited file selinux and change SELINUX=disabled and restated it.

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=disabled
    

    and my problem got solved.

    0 讨论(0)
  • 2020-12-06 17:51

    "setsebool httpd_can_network_connect on" resolves the problem for me

    0 讨论(0)
提交回复
热议问题