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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:36:22+00:00 2026-05-20T08:36:22+00:00

I need to POST some XML data to a remote server for processing. The

  • 0

I need to POST some XML data to a remote server for processing. The server protocol is already defined and unchangeable. The XML data I want to post is dynamically generated within a PHP page running on a local server. I do not want the user to have to save that XML data to a file and then browse for the file to upload it to the remote server (this would not be user-friendly and pointless). My question is how to do this using PHP functions (it would be possible to do it by coding an HTML form with an ‘input file=’ field, but this means that the user has to browse for the file). I have been given an example, and what I need is to write PHP code that will exactly reproduce the headers in the example and send it to the remote server. Any clues to help me?

POST http://doi.crossref.org/servlet/deposit?  operation=doMDUpload&login_id=USER&login_passwd=PSWD&area=live HTTP/1.1 
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* 
Accept-Language: en-us Content-Type: multipart/form-data; boundary=---------------------------7d22911b10028e 
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461) 
Host: Myhost 
Content-length: 1304 Pragma: no-cache -----------------------------7d22911b10028e 
Content-Disposition: form-data; name="fname"; filename="crossref_query.xml" 
<?xml version="1.0" encoding="UTF-8"?> 

.....XML data....

-----------------------------7d22911b10028e--

Things I have tried without success: a form and a input=hidden field for the XML data (the POSTed data does not include a filename and so is rejected by the remote server); http_post_data() – just gave me an internal server error at the remote server; hand coding the data stream and sending it through a a port 80 socket after using fopensocket – the server didn’t recognise that the stream contained POSTed form data, even after checking the stream I sent, character by character using tcpdump. So as you can tell, I’m getting desperate!

  • 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-20T08:36:22+00:00Added an answer on May 20, 2026 at 8:36 am

    from here…

     $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
        curl_setopt($ch, CURLOPT_URL, _VIRUS_SCAN_URL);
        curl_setopt($ch, CURLOPT_POST, true);
        // same as <input type="file" name="file_box">
        $post = array(
            "file_box"=>"@/path/to/myfile.jpg",
        );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post); 
        $response = curl_exec($ch);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to capture the HTML and do some post processing on the HTML
I need to POST data to a url in the middle of a script.
I have an action which I need to post forward onto another action if
I am working on a ASP.NET app and i have a need to post
I need to send PUT and DELETE along with POST, GET to a REST
I have a similar problem to this post . I need to display up
I need to create a PHP script that receives XML input via an HTTP
I have a fixedURL to which I'd like to post different types of xml
Need a function that takes a character as a parameter and returns true if
Need a way to allow sorting except for last item with in a list.

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.