I am developing a bot application that login into a chat application (et chat) and send messages to users. The application itself send Ajax requests periodically to retrieve online users and It returns the users list as json object like a charm. Even when I resend the request in firebug console manually It works good again but when i copy request as cURL in firebug and send it with cURL command engine the request successfully send but i give a database error from server:
Array
(
[0] => 42000
[1] => 1064
[2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
)
SELECT ekhraj FROM db1_etchat_user where etchat_user_id =
Fatal error: Call to a member function fetchAll() on a non-object in /home/mokhtal/domains/mokhtal.com/public_html/class/ConnectDB.class.php on line 76
It is very strange think because I think there is not any difference between this two same request to server so I should not get two different responses.
I don't think providing more information can help to finding the problem but I would be appreciate if You inform me about the need to more information.
thanks
EDIT: The request and response headers when the request sends normally with browser and receive valid answer are :
Response Headers
Cache-Control no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
Connection close
Content-Type application/json; charset=utf-8
Date Wed, 02 Oct 2013 14:23:53 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
Pragma no-cache
Server lighttpd/1.4.28
Transfer-Encoding chunked
X-Powered-By PHP/5.3.27
Request Headers
Accept text/javascript, text/html, application/xml, text/xml, */*
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Content-Length 18
Content-Type application/x-www-form-urlencoded; charset=UTF-8
Cookie PHPSESSID=q0guk9lf3d2gb0lgs2ebejhb72; db1_cookie_test=1380723404; cookie_last_login=1380723823; cookie_anzahl_logins_in_XX_sek=1
Host mokhtal.com
Referer http://mokhtal.com/?Chat
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0
X-Prototype-Version 1.7
X-Requested-With XMLHttpRequest
and POST parameter is :
reloadsequenz=4000
when I use copy as cURL menu in firebug , It returns below code :
curl 'http://mokhtal.com/?ReloaderUserOnline' -H 'Accept: text/javascript, text/html, application/xml, text/xml, */*' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.5' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Cookie: PHPSESSID=q0guk9lf3d2gb0lgs2ebejhb72; db1_cookie_test=1380723404; cookie_last_login=1380723823; cookie_anzahl_logins_in_XX_sek=1' -H 'Host: mokhtal.com' -H 'Referer: http://mokhtal.com/?Chat' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0' -H 'X-Prototype-Version: 1.7' -H 'X-Requested-With: XMLHttpRequest' --data 'reloadsequenz=4000'