Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8084541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:49:57+00:00 2026-06-05T17:49:57+00:00

I have a .erb page and when a user is logged in it contains

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:49:58+00:00Added an answer on June 5, 2026 at 5:49 pm

    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:

    if logged_in?
      uri = URI.parse('http://remoteurl.com/script.php')
      http = Net::HTTP.new(uri.host, uri.port)
      params = { 'id' => current_user.id }
      request = Net::HTTP::Post.new(uri.request_uri)
      request.set_form_data(params)
      http.request(request)
    end
    

    You can tailor your specific needs by reading up on Net:HTTP. Also, I recommend making this an asynchronous task with something like Resque.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using rails beta 3 and I have a erb page named index.html.erb
I have an .erb file where I'd like to return the following text: Name
I want to render for facebook bot special data. I have og.html.erb <!DOCTYPE html><html><head>
I have this code in a .html.erb file: <script src=http://connect.facebook.net/en_US/all.js#xfbml=1></script> <script> FB.Event.subscribe('edge.create', function(response) {
I have some javascript I would like to execute only if a user is
I have an index.html.erb page timesheet that has various js and jquery tables and
I have a page where a user can enter a message, and subsequently that
I have a partial page in my application named _dashboard.html.erb. Inside of the dashboard,
I have a search controller and index page: # search/index.html.erb <% @user_prices.each do |up|
In my Rails application, user may have custom page templates (not for the application)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.