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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:40:57+00:00 2026-05-26T16:40:57+00:00

I have a set of php processing pages that interact together by passing data

  • 0

I have a set of php processing pages that interact together by passing data via get, but now I have to pass JSON between a couple of the processing pages and need the same functionality as when using GET.

The current working get method:

//The guts

header("Location: $moreprocessing_url/?userid=$id");

exit();

Then in the moreprocessing_url picks up:

$userid = $_GET[id];

//More guts

$something = 'important';

header("Location: $public_url/?something=$something");

exit();

So now in the first processing page, instead of sending a simple string, I need to send JSON – so I am using CURL to post the JSON – but after the post I would like the page being posted to to continue the processing and have the original page stop. The same way the above code works but using CURL/post instead. Maybe my understanding of CURL isn’t strong enough and this just isn’t possible?

My CURL:

$curl = curl_init($moreprocessing_url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Content-type: application/json"));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

curl_exec($curl);
curl_close($curl);

exit();

So this returns to the current page where the CURL is happening and not the moreprocessing_url which I want — is this possible? Basically I want the page being posted to, to take over and the one sending the CURL to stop.

  • 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-26T16:40:57+00:00Added an answer on May 26, 2026 at 4:40 pm

    I believe you’re trying to do this:

    1. Browser asks for guts.php
    2. guts.php posts JSON-encoded data to more-guts.php
    3. more-guts.php processes the posted JSON and returns a 301 moved temporarily response; the new location being public.php?something=important
    4. guts.php receives this response and relays it to the browser
    5. Browser follows the redirect

    If this is true then you need little tweaking to your cURL script. Something along these lines:

    $curl = curl_init("url.php"); // the URL that processes your POST
    
    curl_setopt($curl, CURLOPT_POST, true); // use POST method
    curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json")); // set POST header
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // set POST body
    
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // send output to a variable for processing
    curl_setopt($curl, CURLOPT_HEADER, true); // set to true if you want headers in the output
    curl_setopt($ch, CURLOPT_NOBODY, true); // set to true if you do not want the body
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); // set to false if you want to see what redirect header was sent
    
    $output = curl_exec($curl);
    curl_close($curl);
    
    var_dump($output);
    

    Depending values used for CURLOPT_HEADER and CURLOPT_NOBODY, the $output variable will contain the response header, body or both (they’re separated by two blank lines). If you want something from the header, you can use regular expressions to extract the desired header and send it to the browser.

    OR you can echo the body should you choose to do so.

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

Sidebar

Related Questions

I currently have a form set up that passes some data to a php
I have some jquery/php interaction set up on a page. It submits some data
I have a PHP page that returns a piece of HTML to set the
I have a PHP-generated page which is displaying some data about a set of
I have a php script that does some processing (creates remittance advice PDFs, self-billing
I am trying to get the fastspring subscription payment processing set up. I have
I have a set of .php files in a folder, I want to add
I have set the form decorators in this way: <?php $this->setElementDecorators(array( 'Label', array(array('labelTd' =>
I have a small ajax application built with php. Using phpMyAdmin I have set
I have to set some routing rules in my php application, and they should

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.