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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:27:38+00:00 2026-05-26T06:27:38+00:00

code is as below: <?php //set up variables $theData = ‘<?xml version=1.0?> <note> <to>php.net</to>

  • 0

code is as below:

<?php
//set up variables
$theData = '<?xml version="1.0"?>
<note>
    <to>php.net</to>
    <from>lymber</from>
    <heading>php http request</heading>
    <body>i love php!</body>
</note>';
$url = 'http://www.example.com/script.php';

//create the httprequest object                
$httpRequest_OBJ = new httpRequest($url, HTTP_METH_POST, $options);
//add the content type
$httpRequest_OBJ->setContentType = 'Content-Type: text/xml';
//add the raw post data
$httpRequest_OBJ->setRawPostData ($theData);
//send the http request
$result = $httpRequest_OBJ->send();
//print out the result
echo "<pre>"; print_r($result); echo "</pre>";
?>

Now httprequest calls the script here:

http://www.example.com/script.php

Over there I want to access the object, so that I can manipulate the data and send it back:

$httpRequest_OBJ->setRawPostData ($theData);

but it does not work. I tried $_POST['theData'], but this only works if you use $r->**addPostFields**(array('user' => 'mike', 'pass' => 's3c|r3t'));

How can I access the object $theData?

Thanks.

  • 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-26T06:27:39+00:00Added an answer on May 26, 2026 at 6:27 am

    I think what you are after is php://input

    So you can get the whole lot of XML that you posted like this:

    $fp = fopen('php://input','r');
    $data = '';
    while (!feof($fp)) $data .= fread($fp,1024);
    // $data should now contain the XML posted in your example
    

    As a side note, I think the line

    $httpRequest_OBJ->setContentType = 'Content-Type: text/xml';
    

    …should probably just read

    $httpRequest_OBJ->setContentType = 'text/xml';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I convert the below PHP code to VB.NET? <?php $X_HOST =foo.com; $X_URL
My PHP code below shows an image on browser as its original size 300x300.
What is the simplest, fastest way to complete the PHP code below such that
The code below gets the username/password and runs it thru the backend.php script. <?php
I have example of code below. <script type=text/javascript src=assets/scripts/somescript.php>. </script> So, will my browser
I have a basic PHP question, take the code below for example, let's say
For the below code, there ia a form in the location /home/form.php .How can
I want to know if the below code: <?php printf (%s, $some_variable); ?> is
When I use a conditional statement targeting IE6 and below with some PHP code
Within the code below, how do I set VAR as some variable and then

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.