开发者

Run a AJAX query which uses PHP code that limits queries/sec on client side?

开发者 https://www.devze.com 2023-01-31 22:47 出处:网络
I have a PHP Code, tha开发者_JAVA技巧t uses a web service to query some data. However, this web service limits queries per second based on the server (i m not sure about the exact mechanism, but it se

I have a PHP Code, tha开发者_JAVA技巧t uses a web service to query some data. However, this web service limits queries per second based on the server (i m not sure about the exact mechanism, but it seems to be the IP address)

I m using ajax to query this data from a PHP file on my server, but is there some way I can let my client search this data for themselves by faking that they are requesting the data rather than my servers?

The issue is I am getting a RateExceeded error message from server, as soon as two clients are requesting the same page, which is rather obvious since the webservice is only seeing one server, which is my server.

So, can I somehow, make it happen that when these clients query the data, the service is rather thinking that the request is being originated via these clients, rather than my server.


You can't really fake it, but if you could query the webservice directly via AJAX, it should be seeing the clients' IP addresses. Note that if you're doing any kind of processing on the data that the WS returns, you'd have to perform it in JavaScript, on the client side.

If the request from your server to the WS contains any confidential data (e.g. some kind of access key) which the clients must not see, this approach is useless.

0

精彩评论

暂无评论...
验证码 换一张
取 消