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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:37:21+00:00 2026-06-10T12:37:21+00:00

I have two sites on the same server: api.mysite.com john.mysite.com On my API site,

  • 0

I have two sites on the same server:

api.mysite.com
john.mysite.com

On my API site, I have a service that accepts a POSTed json array. In my john.mysite.com site I’m calling the service and posting it using:

 $info['id'] ="oo_".uniqid();
 $info['version'] ="5";

 $url = "http://api.mysite.com/services/addclient";
 $posted_fields = json_encode($info);

   $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   $result = curl_exec($ch);
   echo $result;

When this is called, I’m not getting anything posted to the webservice. I’ve gone into that code and dumped out $_POST and it’s empty. Why isn’t the curl sending the data via POST?

Thanks for any help!

  • 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-10T12:37:23+00:00Added an answer on June 10, 2026 at 12:37 pm

    One problem is that you are json_encodeing the data instead of form encoding it.

    Another is that $info might not be initialized.

    Another is that you typo’d $postfields on line 9.

    Try:

    $info['id'] ="oo_".uniqid();
    $info['version'] ="5";
    
    $url = "http://api.mysite.com/services/addclient";
    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($info));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $result = curl_exec($ch);
    echo $result;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two MVC3 sites, both hosted on the same server that I've configured
I am wanting to have the EXACT same data across two WordPress sites that
I have two separate websites on the same server. One site is a forum
i have hosted two sites on same server and i mange them giving folders
I have this two sharepoint web application that resides on the same server with
I have two django sites that use the same database and share some of
I have two versions of the same proof-of-concept site: The unsecure version: http://www.tlsadmin.com/tlsadmin/PortalHome.aspx and
I have two ASP.NET sites (they can not run in the same process) and
I have two sites that are app1 and app2. If a user requests a
Lets say a have two sites. Site A and site B. On site A

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.