I want to receive the post request on a web page while my page isn't refreshing or is still or just open, sort of concept like dynamic messages without refreshing the page. I don't want to pull it using ajax
I tried sending request to that URL but that doesn't work. I wanted to know a way to receive a post data and display it to user.
Any help is appreciated.
I read about amazon sns push for http/s, but they too doesn't send request to each browser page. they just send the request to the server, how should i make things in a way that , that post request from amazon goes to every browser page wherever it is open and display the content in the post message.
Maybe you are looking for WebSocket? It is basically a protocol used to send information from server to client without the need for the client to make a request. Similar to what chats systems like facebook messenger use, it stops the client having to poll a server for data.
Related
I am new to the term webhook, and i understand that it is a normal HTTP POST request, so when i send the data to an endpoint it utilizes this data and i can test this on a tool like (webhook.site), and what is noticeable on webhook.site it shows me directly the posted data on the real time. I need some help to know how this real time updates can be done using a custom webhook. If i created a PHP file that with will receive a posted data i don't know how to update the page upon request automatically.
I will try to explain what I need. I am using API of some website that sends message to phone number. When user writes his phone number into the form of my website, the data is sent to another website. I want the data to be sent without opening new window or link. Is it possible? Let the link be "example.com?number=123456789".
Have you tried using AJAX technology?
AJAX is a developers dream, because you can: Update a web page
without reloading the page Request data from a server - after the
page has loaded Receive data from a server - after the page has
loaded Send data to a server - in the background
http://www.w3schools.com/ajax/
We are making a app with php in which we want to push data to client browser same in the way in which facebook notificaiton sent by facebook. i know about commet and also have used ajax in past but ajax is not efficeint while commet programing is out of my mind.
Sample can seen at ESPNCRICINFO.COM live scorecard which is automatically pushed
by server to brwoser and than append to document without refreshing. Same app we
have to made.
Simply i need to build some code that send data to all the browser which have our webpage opened. No restrictions. Just need to send to all. So there is no need to check to whom data will be push.
I really need it urgently.
can you use JavaScript setTimeout(function name, seconds) ?
In JavaScript function you can generate .post request for some PHP script which can load messages, when the message will load, you can show it via you JavaScript. the timer will call this function for all people.
I'm building some efficiency tools for a crappy website. This website uses http-posts for some of it's navigation. What I need is that when a user runs a script on an url (redirect.php), I want the client to post to an url on an external site, with some variables.
I know I could do this with javascript, creating a form and posting to it, but I would prefer doing it with php if possible. It needs to be the client that get's forwarded, because they are authenticated with the website that I'm sending them to.
The only way to make a browser send a POST request anywhere is by making a form and submitting it, or doing equivalent trickery using Javascript. You cannot make a browser issue a POST request in response to a redirect response. There are specifications for response codes which allow "POST redirects", but no current browser implements them.
What I'm doing at the moment is creating a row in a table for each Facebook request that gets sent. Then, every time a user opens up the FB friend picker to send a request I make a call to a php file that requests information from that table and returns with a list of the FB user ids of all the people they have sent a request to in the last 24 hours. I do this for each type of request the user can send.
The issue I'm having at the moment is that if the user initiates a request, sends them off to a number of people, and then immediately opens the FB friend picker again the previous request action's records have not yet all been added to our internal table. Thus, the players, if they go fast enough, can send multiple requests to the same FB friends.
Is there a way, on the FB side, to limit this behavior Or is this entirely up to the developer to constrain? For either case, is there a recommended method by which I should achieve this behavior? Thank you.
Update
It occurred to me that our DB is keeping multiple requests from being entered on a per-user-per-24-hour period. What I do now is simply allow the second request to be made on the FB side and when the code attempts and fails to enter the second row into our DB it makes a FB Graph call that uses the app's auth_token to delete the request from Facebook itself. This means that it will show up for a moment on the receiving player's request page on Facebook but since it isn't linked with a row in the internal DB the user won't receive any reward for clicking-thru anyway.
Thanks for the suggestions, though, everybody. #Gil Birman I went ahead and accepted your answer since it's perfectly valid, even if it's not what I ultimately used to fix the problem. Thanks!
There are several ways to solve the lag problem you mentioned, one way would be to disable your send request button via javascript as soon as it is pressed. In your javascript code, instead of immediately displaying the send request dialog via FB.UI, send a json request to your server. Only when the server responds should you display the fb send request dialog. Also, the response that the server sends should include the list of friends to exclude. After the fb request is sent your javascript code should send one more json request to the server to indicate what rows in the database needs to be updated. Only when the server responds this second time should you finally re-enable your send request button.
However, there is no way to actually limit the # number of requests that your user can send. That is, no matter how well you design your javascript/php code, your user could still theoretically invoke the request dialog via the Javascript console to completely bypass your attempts to secure the app.