2013-04-22 94 views
2

您好,我在REST API中遇到了一個問題,因爲我開發了一個用於檢查電子郵件和密碼的函數。和測試過程中我發送通過捲曲控制檯這個數據,它是工作的罰款使用高級Rest客戶端向RESTful發送數據Chrome

C:\curlw32>curl -i -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost/mobile-app/api/login -d" {\"email\":\"[email protected]\",\"password\":\" 
123\"}" 
HTTP/1.1 200 OK 
Date: Mon, 22 Apr 2013 06:21:37 GMT 
Server: Apache/2.2.20 (Ubuntu) 
X-Powered-By: PHP/5.3.6-13ubuntu3.3 
Set-Cookie: PHPSESSID=63ba20f54ab6e233297c4bc022ae256c; path=/ 
Content-Length: 33 
Set-Cookie: 63ba20f54ab6e233297c4bc022ae256c=DEFAULT%7C0%7C2M3TMlgUx3gTlaarYzHIdD28l8q9FTcNub 
t55%2BUGpAo%3D%7C7456bf61db3500c8bb7b3bc38082a470ce4a2ad3; path=/ 
Vary: Accept-Encoding 
Content-Type: text/html 
"Email or password is incorrect!" 

,但是當我使用高級REST客戶端應用程序瀏覽器擴展程序測試它是shwoing此錯誤

<html><head><title>Slim Application Error</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}</style></head><body><h1>Slim Application Error</h1><p>The application could not run because of the following error:</p><h2>Details:</h2><strong>Message:</strong> Trying to get property of non-object<br/><strong>File:</strong> D:\wamp\www\mobile-m-panels\api\index.php<br/><strong>Line:</strong> 39<br/><h2>Stack Trace:</h2>#0 D:\wamp\www\mobile-m-panels\api\index.php(39): Slim::handleErrors(8, 'Trying to get p...', 'D:\wamp\www\mob...', 39, Array)<br /> 
#1 [internal function]: authentication()<br /> 
#2 D:\wamp\www\mobile-m-panels\api\Slim\Route.php(392): call_user_func_array('authentication', Array)<br /> 
#3 D:\wamp\www\mobile-m-panels\api\Slim\Slim.php(1052): Slim_Route->dispatch()<br /> 
#4 D:\wamp\www\mobile-m-panels\api\index.php(28): Slim->run()<br /> 
#5 {main}</body></html> 

可以在任何身體建議必要的改變? 我捕捉的數據代碼

$request = Slim::getInstance()->request(); 

$login_details = json_decode($request->getBody()); 

回答

相關問題