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 483585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:12:46+00:00 2026-05-13T01:12:46+00:00

I have a form on my site which sends data to some remote site

  • 0

I have a form on my site which sends data to some remote site – simple html form.
What I want to do is to use data user enters into form for statistical purposes.
So I instead of sending data to the remote page I send it first to my script which resends it the remote site.

The thing is I need it to behave in exact way the usual form would behave taking user to the remote site and displaying resources.

When I use this code it kinda works but not in the way I want it to:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $action);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
curl_close($ch);

Problem is that it displays response in the same script. For example if $action is for example:
somesite.com/processform.php and my script name is mysqcript.php it would display the response of “somesite.com/processform.php” inside “mysqcript.php” so all the relative links are not working.
How do I make it to send the user to “somesite.com/processform.php”? Same thing that pressing the button would do?

Leonti

  • 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-05-13T01:12:46+00:00Added an answer on May 13, 2026 at 1:12 am

    There are several ways to do that. Here’s one of the easiest: just use a 307 redirect.

     header('Location: http://realsite.com/form_url.php', true, 307');
    

    You can do your logging and stuff either before or after header() but if you do it after calling header() you will need to start your script with

    ignore_user_abort(true);
    

    Note that browsers are supposed to notify the user that their form is being redirected.

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

Sidebar

Related Questions

I have a site that has a simple HTML button in a form. All
I have a custom site definition which includes a form library. I have a
I have subclassed Form to include some extra functionality, which boils down to a
I have a form with some radio buttons that are disabled by default. When
I have a form in which people will be entering dollar values. Possible inputs:
I'm hoping someone on this site can offer some help. I have a page
I have a web page containing a login form which loads via HTTP, but
I have a typical mail.php script, which uses the mail() function. After the user
I have a signup form on my home page which uses server side validation
I have a site running on windows server 2008. The site is HTML, and

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.