I have a .erb page and when a user is logged in it contains the data like in below code.
<% if logged_in? -%>Welcome, <%= current_user.id %><% end -%>
So what I need is to pass this data to a PHP page using a URL, and it should be done without user interaction(without links,buttons) because the user is already logged in. I know some code like
Link to another site this but I don’t know how to do this in ruby on rails, also this should be automatically submitted to another php page in a different server.
Thanks in advance.
For the sake of demonstration, I’ll assume you’re making a POST request. You can use ruby’s built in Net:HTTP and URI libraries in your controller action method to make such a request:
You can tailor your specific needs by reading up on Net:HTTP. Also, I recommend making this an asynchronous task with something like Resque.