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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:14:23+00:00 2026-05-26T02:14:23+00:00

what is the equivalent code in asp.net language??? <?php $ch = curl_init(http://irnafiarco.com/queue); $request[queue] =

  • 0

what is the equivalent code in asp.net language???

<?php
$ch = curl_init("http://irnafiarco.com/queue");
$request["queue"] = file_get_contents("/path_to_my_xml_file/my_xml_file.xml");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($ch);
curl_close ($ch);
echo $response;
?>

in http://irnafiarco.com/queue a Listener that get requst xml file and saver xml file.

  • 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-26T02:14:23+00:00Added an answer on May 26, 2026 at 2:14 am

    Using WebRequest, this will be the basic code

       var req = WebRequest.Create(@"http://irnafiarco.com/queue"))
    
       // prepare the request
       req.ContentType = "application/x-www-form-urlencoded";
       req.Method = "POST";
    
       // push the file contents into request body
       var data = "queue=" + System.IO.File.OpenText(filePath).ReadToEnd();
       var bytes = System.Text.Encoding.Ascii.GetBytes(data );  
        request.ContentLength = bytes.Length;
       var rs = req.GetRequestStream();
       rs.Write(bytes, 0, bytes.Length); 
       rs.Close ();
    
       // get the response
       var resp = req.GetResponse();
       var sr = new System.IO.StreamReader(resp.GetResponseStream());
       var result = sr.ReadToEnd();
    

    Disclaimer: untested code

    EDIT:
    Added the post parameter name (“queue”) which I have missed in first draft. Also added content-length for the request. This code should get you started. The basic idea is you need to simulate exact post request generated by PHP code. Use tool such as Fiddler/ Firebug on FF to inspect & compare request/response from PHP and .NET code.

    Further, I suspect that the PHP code may generating request with content type as multipart/form-data. However, I believe that server should also able to support the post body with application/x-www-form-urlencoded (because we have only one parameter in body) but in case it doesn’t work and you must generate POST body as multipart/form-data then it will be little more involved. See this SO question where accepted answer has given the sample code for the same : Upload files with HTTPWebrequest (multipart/form-data)

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

Sidebar

Related Questions

What's the ASP.NET equivalent of this PHP code? $db = new mysqli(/*some data*/); $db->query('INSERT
Does The StackExchange MiniProfiler http://code.google.com/p/mvc-mini-profiler/ work in ASP.NET MVC2? If so, how? When adding
ASP.NET has a reorderlist control http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/ReorderList/ReorderList.aspx Is there anything equivalent (control, source code, ...)
Is there an equivalent in ASP.NET to memcached usage in PHP? Is there even
i am new to asp.net.Can you post an equivalent vb.net code following the C#.net
what is the equivalent of ASP.NET HttpModules in PHP? If there are any how
Check out this code sample from Scott Guthrie's blog: http://weblogs.asp.net/blogs/scottgu/image_43366964.png Notice item is a
Could you please show me the C# Equivalent of this VB.NET code: Public Partial
I believe the following VB.Net code is the equivalent of the proceeding C# code;
I have an ASP.NET site that I am maintaining. Currently it has code that

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.