请求从firebug复制,因为cURL请求不起作用

时间:2013-10-02 14:18:10

标签: php curl libcurl

我正在开发一个登录到聊天应用程序(聊天)并向用户发送消息的机器人应用程序。 应用程序本身定期发送Ajax请求以检索在线用户,并将用户列表作为json对象返回,就像魅力一样。 即使我手动在firebug控制台中重新发送请求它再次运行良好但是当我在firebug中将请求复制为cURL并使用cURL命令引擎发送请求成功发送但我从服务器发出数据库错误:

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

这很奇怪,因为我认为这两个相同的服务器请求之间没有任何区别,所以我不应该得到两个不同的响应。

我不认为提供更多信息可以帮助找到问题,但如果您告知我需要更多信息,我将不胜感激。

感谢

编辑:请求通过浏览器正常发送并收到有效答案时的请求和响应标头是:

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

和POST参数是:

reloadsequenz=4000

当我在firebug中使用copy作为cURL菜单时,它返回以下代码:

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'

1 个答案:

答案 0 :(得分:-1)

对我而言,似乎cURL没有url来引用为什么它是一个非对象

相关问题