2
我想登錄到 out university food reservation所以編輯action
窗體在谷歌瀏覽器併發送數據到我的網站,看看我發送了什麼,當我按下提交按鈕。無法通過php curl登錄
__LASTFOCUS=&__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=/wEPDwULLTEyMDgzNjUwNDIPZBYCAgMPZBYSAgEPDxYCHgRUZXh0BboB2LPbjNiz2KrZhSAg2KfZhNqp2KrYsdmI2YbbjNqp24wg2KfZgdiy2KfbjNi0INin2LnYqtio2KfYsSDZiCDYrtix24zYryDamNiq2YjZhiDYr9in2YbYtNqv2KfZhyDYtdmG2LnYqtuMINiu2YjYp9is2Ycg2YbYtduM2LHYp9mE2K/bjNmGINi32YjYs9uMINiv2KfZhti02qnYr9mHINio2LHZgiDZiCDaqdin2YXZvtuM2YjYqtixZGQCAw8PFgYfAAVL2YbYp9mFINqp2KfYsdio2LHbjCDZiCDaqdmE2YXZhyDYudio2YjYsSDYrtmI2K8g2LHYpyDZiNin2LHYryDZhtmF2KfYptuM2K8uHghDc3NDbGFzcwUHbWVzc2FnZR4EXyFTQgICZGQCBQ8PFgIeB1Zpc2libGVoZGQCBw8WAh8DaGQCCQ8PFgIfA2hkZAIVDw8WAh8ABbML2K/Yp9mG2LTYrNmI2YrYp9mGINiv2KfZhti02qnYr9mHINio2LHZgiDZiCDaqdin2YXZvtmK2YjYqtixINio2Ycg2YXZhti42YjYsSDYp9mB2LLYp9mK2LQg2KfYudiq2KjYp9ixINin2YrZhtiq2LHZhtiq2Yog2Ygg2LHYstix2Ygg2LrYsNinINmF2Yog2KjYp9mK2LPYqiDYqNmHINmG2qnYp9iqINiw2YrZhCDYqtmI2KzZhyDZhtmF2KfZitmG2K8uDQoNCjEt2YbYp9mFINqp2KfYsdio2LHZiiDZiCDYsdmF2LIg2LnYqNmI2LHYjCDYtNmF2KfYsdmHINiv2KfZhti02KzZiNmK2Yog2LTZhdinINmF2Yog2KjYp9i02K/YjCDaqdmHINm+2LMg2KfYsiDZiNix2YjYryDZhdmKINio2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mI2Yog2YXYsdio2Lkg2LPZhNmBINmH2YXYp9mGINix2YjYsiDaqdmE2YraqSDZiCDYqtin2YrZitivINmG2YXYp9mK2YrYry4NCg0KNS3YqNmHINmF2YbYuNmI2LEg2KfZhti12LHYp9mBINin2LIg2LrYsNin2Yog2LHYstix2Ygg2LTYr9mH2Iwg2YXZiiDYqtmI2KfZhtmK2K8g2KrYpyDZitqpINix2YjYsiDZgtio2YQg2KfYsiDZhdmI2LnYryDYqtit2YjZitmEINi62LDYp9iMINio2Kcg2LXZgdixINmG2YXZiNiv2YYg2KrYudiv2KfYryDYutiw2Kcg2K/YsSDYsdmI2LIg2YXZiNix2K8g2YbYuNix2Iwg2YLYr9in2YUg2YbZhdin2YrZitivLmRkAhcPFgIfA2hkAhkPDxYCHwAFDlZlcnNpb24gOiA3Ljg5ZGQCGw8PFgIfAAWCASDaqdmE2YrZhyDYrdmC2YjZgiDYp9mK2YYg2KfYq9ixINi32KjZgiDZgtmI2KfZhtmK2YYg2YbYsdmFINin2YHYstin2LHZiiDZhdiq2LnZhNmCINio2Ycg2LTYsdqp2Kog2KzZh9in2YYg2q/Ys9iq2LEg2YXZitio2KfYtNivLiBkZGQaTTds32c97LYgZhFGpQ6mmaEMKg==&__EVENTVALIDATION=/wEWBALtyp+2DQKl1bKdCAK1qbT2CQKC3IfLCT5A0UwjzwbH6JTK21okH7qC0C74&txtusername=myusername&txtpassword=mypassword&btnlogin=ورود&
之後,我開發e代碼與PHP和捲曲自動做到這一點。
$post_fields = '__LASTFOCUS=&__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=/wEPDwULLTEyMDgzNjUwNDIPZBYCAgMPZBYSAgEPDxYCHgRUZXh0BboB2LPbjNiz2KrZhSAg2KfZhNqp2KrYsdmI2YbbjNqp24wg2KfZgdiy2KfbjNi0INin2LnYqtio2KfYsSDZiCDYrtix24zYryDamNiq2YjZhiDYr9in2YbYtNqv2KfZhyDYtdmG2LnYqtuMINiu2YjYp9is2Ycg2YbY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g2YXZiNix2K8g2YbYuNix2Iwg2YLYr9in2YUg2YbZhdin2YrZitivLmRkAhcPFgIfA2hkAhkPDxYCHwAFDlZlcnNpb24gOiA3Ljg5ZGQCGw8PFgIfAAWCASDaqdmE2YrZhyDYrdmC2YjZgiDYp9mK2YYg2KfYq9ixINi32KjZgiDZgtmI2KfZhtmK2YYg2YbYsdmFINin2YHYstin2LHZiiDZhdiq2LnZhNmCINio2Ycg2LTYsdqp2Kog2KzZh9in2YYg2q/Ys9iq2LEg2YXZitio2KfYtNivLiBkZGQaTTds32c97LYgZhFGpQ6mmaEMKg==&__EVENTVALIDATION=/wEWBALtyp+2DQKl1bKdCAK1qbT2CQKC3IfLCT5A0UwjzwbH6JTK21okH7qC0C74&txtusername=8909103&txtpassword=temptemp&btnlogin=ورود&';
$ch = curl_init("http://stu24.kntu.ac.ir/Login.aspx");;
$cookie = fopen("temp.txt", "w+");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
$x = curl_exec($ch);
echo ($x);
curl_close($ch);
但它會從服務器返回錯誤。
Server Error in '/' Application. The state information is invalid for this page and might be corrupted. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted. Source Error: The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL: 1. Add a "Debug=true" directive at the top of the file that generated the error. Example: or: 2) Add the following section to the configuration file of your application: Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode. Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario. Stack Trace: [FormatException: Invalid length for a Base-64 char array.] System.Convert.FromBase64String(String s) +0 System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72 System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4 System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37 System.Web.UI.HiddenFieldPageStatePersister.Load() +113 [ViewStateException: Invalid viewstate. Client IP: 209.54.48.51 Port: 47212 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 ViewState: /wEPDwULLTEyMDgzNjUwNDIPZBYCAgMPZBYSAgEPDxYCHgRUZXh0BboB2LPbjNiz2KrZhSAg2KfZhNqp2KrYsdmI2YbbjNqp24wg2KfZgdiy2KfbjNi0INin2LnYqtio2KfYsSDZiCDYrtix24zYryDamNiq2YjZhiDYr9in2YbYtNqv2KfZhyDYtdmG2LnYqtuMINiu2YjYp9is2Ycg2YbYtduM2LHYp9mE2K/bjNmGINi32YjYs9uMINiv2KfZhti02qnYr9mHINio2LHZgiDZiCDaqdin2YXZvtuM2YjYqtixZGQCAw8PFgYfAAVL2YbYp9mFINqp2KfYsdio2LHbjCDZiCDaqdmE2YXZhyDYudio2YjYsSDYrtmI2K8g2LHYpyDZiNin2LHYryDZhtmF2KfYptuM2K8uHghDc3NDbGFzcwUHbWVzc2FnZR4EXyFTQgICZGQCBQ8PFgIeB1Zpc2libGVoZGQCBw8WAh8DaGQCCQ8PFgIfA2hkZAIVDw8WAh8ABbML2K/Yp9mG2LTYrNmI2YrYp9mGINiv2KfZhti02qnYr9mHINio2LHZgiDZiCDaqdin2YXZvtmK2YjYqtixINio2Ycg2YXZhti42YjYsSDYp9mB2LLYp9mK2LQg2KfYudiq2KjYp9ixINin2YrZhtiq2LHZhtiq2Yog2Ygg2LHYstix2Ygg2LrYsNinINmF2Yog2KjYp9mK2LPYqiDYqNmHINmG2qnYp9iqINiw2YrZhCDYqtmI2KzZhyDZhtmF2KfZitmG2K8uDQoNCjEt2YbYp9mFINqp2KfYsdio2LHZiiDZiCDYsdmF2LIg2LnYqNmI2LHYjCDYtNmF2KfYsd...] [HttpException (0x80004005): The state information is invalid for this page and might be corrupted.] System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106 System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState) +14 System.Web.UI.HiddenFieldPageStatePersister.Load() +217 System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105 System.Web.UI.Page.LoadAllState() +43 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 System.Web.UI.Page.ProcessRequest() +80 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 System.Web.UI.Page.ProcessRequest(HttpContext context) +49 ASP.login_aspx.ProcessRequest(HttpContext context) +37 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
,如果我這樣做限制$post_fields
只有用戶名和密碼,它會重定向到重新登錄頁面。 問題在哪裏,我該如何解決?