卷动回传失败,连接到< url>:80 [英] Curl returns Failed connect to <url>:80

查看:164
本文介绍了卷动回传失败,连接到< url>:80的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP中第一次使用 Curl 。这是我的代码。

I am using Curl for the first time in PHP. Here is my code.

<?php
    function curl($url){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        $data = curl_exec($ch);
        echo curl_getinfo($ch) . '<br/>';   //returns "Array"
        curl_errno($ch) . '<br/>';    // returns "7"
        curl_error($ch) . '<br/>';    //returns "Failed connect to www.epcc.ed.ac.uk:80; No error"
        curl_close($ch);
        return $data;
        }


        $url = 'http://www.epcc.ed.ac.uk/education-training/general-training/upcoming-courses-and-events/';
        $output = curl($url);
        var_dump($output);  // returns "bool(false)"
?>

我在代码中添加了我在注释中获得的输出。

I have added the output what I get in comments in the code.

任何人都可以告诉我问题在哪里?是一般性问题或任何代理问题。

Can anyone tell me where is the problem? Is it a general issue or any proxy issue.

感谢

推荐答案

它似乎是一个代理问题,因为你怀疑。如果您通过代理连接到您的网络,则需要设置curl。

It appears to be a proxy issue, as you suspected. If you connect to your network via a proxy, this will need to be set-up for curl.

这可能会有帮助 - > 通过代理使用curl

This may help -> Use Curl via Proxy.

这篇关于卷动回传失败,连接到&lt; url&gt;:80的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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