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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:51:50+00:00 2026-06-05T01:51:50+00:00

i have no idea how to solve a problem with sending $_POST. I want

  • 0

i have no idea how to solve a problem with sending $_POST. I want to fill a form at example.com

//at example.com
<form action="foo.php" method="post" >
<input name="bar1" type="text" />
<input name="bar2" type="text" />
<input name="bar3" type="text" />
<input value="Send" type="submit" />
</form>

and then it goes to foo.php :

<?php //foo.php
echo 'added: <p>'.$_POST['bar1'].'<br />'.$_POST['bar2'].'<br />'.$_POST['bar3']; 
?>

and in the same time it also send

$_POST['bar1'], $_POST['bar2'], $_POST['bar3']

to exampledomain.com/foobar.php where it can be saved to a file – that’s not a problem.

I don’t know how to send info to both php scripts at once – one is external one. I guess i have to send it somehow inside foo.php

There is kind of solution – redirecting to exampledomain.com/foobar.php inside foo.php but it isn’t acceptable in my case – I want to do it without making user exit example.com

Thanks in advance and hope you can undestand my problem – if not just ask a comment

EDIT: Based on Pete Herbert Penito’s answer:

 <?php //inside foo.php
 $url = 'http://exampledomain.com/foobar.php';
 $fields_string='';
 foreach($_POST as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
 rtrim($fields_string,'&');

 //open connection
 $ch = curl_init();

 //set the url, number of POST vars, POST data
 curl_setopt($ch,CURLOPT_URL,$url);
 curl_setopt($ch,CURLOPT_POST,count($_POST));
 curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);

 //execute post
 $result = curl_exec($ch);

 //close connection
 curl_close($ch);

  ?>
  • 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-05T01:51:53+00:00Added an answer on June 5, 2026 at 1:51 am

    I would use CURL to construct a post request:

    <?php
     // these variables would need to be changed to be your variables 
     // alternatively you could send the entire post constructed using a foreach
     if(isset($_POST['Name']))     $Name   = $_POST['Name'];
     if(isset($_POST['Email']))   $Email   = $_POST['Email'];
     if(isset($_POST['Message']))   $Message= htmlentities($_POST['Message']);
    
     $Curl_Session = curl_init('http://www.site.com/cgi-bin/waiting.php');
     curl_setopt ($Curl_Session, CURLOPT_POST, 1);
     curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "Name=$Name&Email=$Email&Message=$Message");
     curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
     curl_exec ($Curl_Session);
     curl_close ($Curl_Session);
    ?>
    

    From Link:

    http://www.askapache.com/php/sending-post-form-data-php-curl.html

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

Sidebar

Related Questions

I have come to a problem, wich I have no idea how to solve.
I have a problem and I have no idea how to solve it. I
Actually I have no idea how to solve my problem. I captured some data
i have no idea how to solve my problem, i tried to make 100
Does anyone have any idea how to solve this problem please? This is the
anyone have idea how to solve this problem counts the number of occurrences of
My problem: I have an iframe from my partner <iframe src=http://foo.com/aff_c?offer_id=28&aff_id=1020&file_id=164&url_id=32></iframe> It´s the formular
I have an idea I'm trying to implement. I want to display half a
I have one specific problem and I don't know how to solve it. I
I hope somebody could help me out, I have no idea how to solve

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.