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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:32:00+00:00 2026-06-18T19:32:00+00:00

So I’ve been strugling with this for two days now with not a whole

  • 0

So I’ve been strugling with this for two days now with not a whole lot of success.

What I’m getting is an http POST generated by a webpage that is being sent to a php file that I’m working on creating on my server. So basically I’m trying to create a php listener script that when an http post occurs it will run the script save the xml data into a SimpleXMLElement so that I can write a MYSQL query to import the data into our database. Once I get the data into a SimpleXMLElement, I can take over from there, the issue i’m having is that I cannot get the listener.php file to listen to the HTTP POST and read the data into a local file.

<?php
public void RunServer()
{
    var prefix = "http://*:4333/";
    HttpListener listener = new HttpListener();
listener.Prefixes.Add(prefix);
try
{
    listener.Start();
}
catch (HttpListenerException hlex)
{
    return;
}
while (listener.IsListening)
{
    var context = listener.GetContext();
    ProcessRequest(context);
}
listener.Close();
}

private void ProcessRequest(HttpListenerContext context) 
{
// Get the data from the HTTP stream
var body = new StreamReader(context.Request.InputStream).ReadToEnd();
$data = body
byte[] b = Encoding.UTF8.GetBytes("ACK");
context.Response.StatusCode = 200;
context.Response.KeepAlive = false;
context.Response.ContentLength64 = b.Length;

var output = context.Response.OutputStream;
output.Write(b, 0, b.Length);
context.Response.Close();
}
?>

This code is the closest I’ve gotten to what I need and I get a 500 error when I try to access the page. I’m not going to lie I’m pretty new to php and am having issues understanding function definitions. (Also I did get this code from a StackOverflow ticket that was closed)

I’m currently using php5 and apache on my server for my web hosting. ]
I have a php.info() file setup and can post it if need be.

  • 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-18T19:32:02+00:00Added an answer on June 18, 2026 at 7:32 pm

    If you want to save data into a SimpleXMLElement that will do it:

    <?php
    $xml = new SimpleXMLElement($_POST['xml-value-field']);
    //insert into mysql db...
    //write to local file...
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
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
For some reason, after submitting a string like this Jack’s Spindle from a text

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.