我可以从外部网站检索信息时,我'm在内部网使用php函数file_get_contents


Can i retrieve information from external website when i'm on an intranet using php function file_get_contents?

我试图使用file_get_contents和curl从内部网检索外部网站的信息,但不幸的是我未能获得数据,我已经要求系统管理员给我访问特定网站facebook.com,当我直接在地址栏内输入url时,我可以打开网页,但现在当我想通过内部网访问它时,它给了我一个错误

An error occured while fetching the URI. Please retry.

我的代码是

 $url = 'http://www.facebook.com';
 //curl script to get content of given url
 $ch = curl_init();
 // set the target url
 curl_setopt($ch, CURLOPT_URL,$url);
 // request as if Firefox
 curl_setopt($ch, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U;   Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") ); 
 curl_setopt($ch, CURLOPT_NOBODY, false);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $result= curl_exec ($ch); 
 curl_close ($ch);

和facebook在我们的防火墙上被阻止了,但我想既然我可以直接从浏览器访问,我应该能够访问它,但似乎防火墙没有看到请求是由我发送的,请求可能是由内网IP地址发送的吗?这可能吗?

我已经要求系统管理员给我访问那个特定站点的权限

"我"还是"我的剧本"?

当我想通过内部网访问它时

"通过我的内部网"是什么意思?
你是不是已经进入了内部网,即使"直接在地址栏中输入url"?

无论如何,你仍然需要问你的系统管理员,而不是stackoverflow上的人。我们无法控制你的内网防火墙