有错别字,“我想能不能在php程序里做一下路由追踪”

解决方案 »

  1.   

    从技术上说 a 能访问 b ,b就一定能访问a吗?
    答案是否定的你可以尝试使用curl
      

  2.   

    不是这个问题,我试过好多网站,入baidu.com,163.com,以及我自己在国内的网站。
      

  3.   

    需要注意的是
    file_get_contents 和 curl
    是完全不同的
      

  4.   

    试了curl,还是不行。
    觉得纳闷,国外的服务器访问国外的网站没有问题;
    国内用户访问国外服务器没有问题;
    国外的服务器访问国内的网站有问题。按理说,只要在网站服务器上做限制,file_get_contents访问网站与在那台服务器上上网没有任何区别!
      

  5.   

    我的英文又不好,向他们说半天说不清楚。还在问我的IP是什么,叫我使用 tracert  追踪一下我在国外的域名。
    我想说,我在这里可以 tracert 到你家,现在你你家到国内某个网站不行。  呵呵。
    现在我们的党和人民也在想方设法的阻碍我们与世界人民的交流。我问客服
    Hello, 
    My site's dedicated ip address could not access the sites in China, could you help me to move another server? Thank you. Here is two test url for debug:one is http://www.soonle.com/test1.php this code is<?php 
    echo file_get_contents("http://www.google.com") ; 
    ?> It is OK.Another is http://www.soonle.com/test2.php this code is<?php 
    echo file_get_contents("http://www.baidu.com") ; 
    ?> It is not work, and wraning "time out". I confirm that the timed out do not cause this. 
    客服回答:
     
     Hello,If you are experiencing errors accessing your domain via web, ftp, email or otherwise, please provide us with the following:1.) Your geographic location 
    2.) Your ISP 
    3.) Your IP Address (can be obtained at http://www.whatismyip.com/) 
    4.) If applicable, a url we can use to test ( please include username and password if required).:|Traceroute|:. 
    A traceroute doing the following:Windows XP/2000 
    1. Go to Start > Run... 
    2. Enter cmd and click OK. 
    3. At the prompt, type tracert yourdomain.com and hit enter.有些牛头不对马嘴。
    相当于a能访问b,a能访问c,然后b和c就能互访。
      

  6.   

    你现在的问题,是不是:在国外的服务器上,使用file_get_contents或者curl都无法获取国内任何网站的页面?另外tracert只存在于windows,你在国外的服务器,很有可能是*nix系统,这些系统上很可能是traceroute。你可以在服务器上尝试使用exec或者system等PHP函数来执行traceroute,或许可以。
      

  7.   

    首先请确认在国外能用浏览器访问你自己在国内的网站
    然后要给curl设置浏览器参数
      

  8.   


    就是想利用traceroute来确认了。而且必须是在那个服务器上去试。
      

  9.   

    而且可以确认,对国外一般用户来说,访问baidu.com 是绝对没有问题的,想都不用想。
      

  10.   

    还有一个问题,从技术上说 a 能访问 b ,b就一定能访问a吗?不一定,中间要经过代理,网关,路由,所以,通信不一定能通过理论上,IE就是一种代理,所以,一些库可以模拟为代理(如IE),实现IE一样的功能,只要IE能访问,原则上,这相应的代理库也能访问
      

  11.   

    国内和国外访问,一般时间都长,可能导致延时,所以出错由于时间过长,也可能被路由强制中段(所以不一定是file_get_contents出了问题)
      

  12.   

    exec()或system,把返回值用print_r打印出来。如果你是独立主机的话,直接在命令行下执行traceroute就行了
      

  13.   

    嗯。system("tracert xx.xx.xx.xx")或者system("traceroute xx.xx.xx.xx")。
    不过一般情况下空间可能禁止掉system,因为太危险了。另外就是system没被禁掉,但是apache的权限也不够运行tracert的。
    不行就换个虚拟主机吧。