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

  • Home
  • SEARCH
  • 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 9168187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:34:18+00:00 2026-06-17T15:34:18+00:00

I have a sender script and a receiver script. The sender sends an xml

  • 0

I have a sender script and a receiver script. The sender sends an xml file , while the receiver gets it and stores it in the database.

The sender looks like this :

$xml = file_get_contents("data.xml");

  // We send XML via CURL using POST with a http header of text/xml.
  $ch = curl_init();
  // set URL and other appropriate options
  curl_setopt($ch, CURLOPT_URL, "http://localhost/iPM/receiver.php");
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  curl_setopt($ch, CURLOPT_REFERER, 'http://localhost/iPM/receiver.php');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $ch_result = curl_exec($ch);
  echo "Result = ".$ch_result;
  curl_close($ch);

and the receiver :

$xml = file_get_contents('php://input');

parsing the xml - storing to database
etc etc etc etc etc etc etc etc etc

I need when i run the sender script , to get back a response from the receiver that everything was ok and the xml file was received. I believed that i would see that with this line of code , in my code : echo "Result = ".$ch_result; but the only thing i see printed is Result = .

So what am i doing wrong? What should i add on my sender/receiver to have a response back?

  • 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-17T15:34:20+00:00Added an answer on June 17, 2026 at 3:34 pm

    Replace the following lines:

    $ch_result = curl_exec($ch);
    echo "Result = " . $ch_result;
    

    with the following lines and see if it works:

    $ch_result = curl_exec($ch);
    $ch_header = curl_getinfo($ch);
    echo "Status : " . $ch_header['http_code'] . "<br />";
    echo "Result = " . $ch_result;
    

    The curl_getinfo return basic information about the request and the http_code variable returns the response code 200,404 etc. You can then check for the code and parse it as per your requirements.

    Hope it helps.

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

Sidebar

Related Questions

I have some code that looks something like this: <head runat="server"> <script type="text/javascript"> var
I have a code like this. <script runat=server> protected void Page_Load(object sender, EventArgs e)
I have code like this - (IBAction)onClick:(id)sender { NSThread *thread = [[NSThread alloc]initWithTarget:parser selector:@selector(adapter:)
In my main Web Page (Viewer.aspx) I have a javascript script tag like this
I have this little script that generate a table in a .pdf file, but
Have this upload script, and it works. But I would like to add a
Now the data looks like this in the database: Hej [indtaster_navn]<br><br>I forbindelse med noget
I have this javascript method: <script type=text/javascript> function MyFunction(sender, eventArgs) { if (someCondition) {
I have a javascript script like this below which the 'args' contain a string
I have a problem with a Sender and a Server UDP. The SenderUDP sends

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.