我得到了下一个问题。我需要获得几页的HTML。所有对PHP函数file()或file_get_contents()或CURL都有效。PHP:获取aspx文件的内容
但不适用于一个URL! Here it is(当然,我尝试获取未缩短的URL的HTML)。
我试了一下,没有什么帮助。我可以用browswer打开这个页面,它返回200状态,但是...我无法得到它的内容!它返回500错误,当我试图通过卷曲得到它:
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
ASP.ypDetectClass..ctor() +47
ASP.immigration_immigrating_ainp_application_forms_aspx..ctor() +26
__ASP.FastObjectFactory_app_web_obqstzij.Create_ASP_immigration_immigrating_ainp_application_forms_aspx() +20
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +119
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618 "
这是不可能修复,除非你可以修改托管网站 – ajreal
的ASPX源代码,你有权抢的HTML这一页?如果是这样,请向业主寻求帮助。他们很可能故意阻止您的请求。如果没有,我认为我们不能帮助你... – ChrisH
如果你使用Linux,你有没有试图用'wget'来获取这个页面?如果可行,请尝试在抓取页面时操纵发送的HTTP头。 – rabudde