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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:00:00+00:00 2026-06-09T09:00:00+00:00

So, I’m going to receive an API call at: POST http://olddomain.com/api/call Post contents in

  • 0

So, I’m going to receive an API call at:

POST http://olddomain.com/api/call
    Post contents in Raw Body

I need to redirect that to

POST http:://newdomain.com/api/call

With the same Raw Body contents. Seems there’s no way to redirect a POST server-side, and the only way to do it is to generate an HTML form and submit that form via JS. So, given that, I’m not even sure it’s possible for our API clients that are going to expect JSON returned back to them to render and submit that HTML/JS in order to redirect the POST.

So now I’m thinking that I may need to just translate the POST raw body contents into query string variables – the volume of data in the call is probably low enough that we can get away with this – and then maybe update the API call handler to accept GET parameters in this scenario.

None of this seems at all clean. Please tell me there is a better way.

UPDATE: The implementation requires curl compatibility, because the API client uses it.

  • 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-09T09:00:02+00:00Added an answer on June 9, 2026 at 9:00 am

    To redirect a regular page from PHP, you could just run something like this:

    header("Location: http://newdomain.com/api/call");
    exit;
    

    But I’m not sure whether most clients would automatically pass the same POST data (according to Jay above, this would not carry the POST data). Regardless, this is assuming that the client handles HTTP redirects natively, which you can’t rely on for security reasons if the client is running on someone else’s machine. For instance, PHP’s open_basedir setting will not allow curl to follow HTTP redirects.

    For this reason, you can’t expect the client to do the redirect for you. You’re going to have to be a middle-man, and make the new call to newdomain.com internally, then pass the response back down to the client. This probably isn’t an ideal solution, but when you’re hosting an API you have to be careful with what you assume the clients can or will do.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... 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.