send c# array to php web service [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i want to know how to send C# array to php web service .
here c# application is in client and php webpage is in server,this php web service get that array and store in database

you cannot directly send array to php service but what you can do is create a string separated by ','(coma) & then send it in url or as response,
at server side you can just split it & here you get your ans.
Another way is as Elliot said but you need some JSON knowledge.

You must:
Convert your data to JSON or XML using serialization (according to what your service consumes).
Create HTTP POST Query, look at MSDN for classes for doing it.
Put your converted data in the query body.
Send it.

Related

Default User Agent (WebClient Header) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Long explanation made short, I NEED to supply a proper user agent when posting data to my server; Why? I don't know entirely.
In any case, I've read that making a web request prior and grabbing the header from it would suffice, but I'd like to know if there's a more cleaner/sufficient method.
You can indeed just grab one from your favourite browser, or pick one from here.
The user agent string is just that - a string containing various info about the browser. So it's just a matter of passing it along with you request. If your program will live for a while, I'd try to pick one that's as generic as possible.

C# ASP.NET display code on page [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to read in a .cs file from my project which contains a code sample for use by clients of my company's API.
What's the best way to read in this file and pretty-print it to the page with indentations etc. The goal is to just have the code on the page automatically change when I update the contents of this file so that the code sample will always be up to date as published on the live site.
An example of what I'm attempting to accomplish is something similar to this: http://msdn.microsoft.com/en-us/library/vstudio/ezwyzy7b.aspx
I'd use this...
http://www.manoli.net/csharpformat/
http://www.manoli.net/csharpformat/CSharpFormat.zip
It transforms C# code into html. You can read the file run it through the CSharpFormat then output the HTML to a panel in the page.

Downloading files via C# from a php site [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
The site provides links as http://www.example.com/download.php?id=53979 . I know that this is a pdf file and want to download it via a C# program. Is this possible and if yes, how?
In order to download a file, you simply need to use the WebClient object like in the question referenced above:
using (var client = new WebClient())
client.DownloadFile("http://www.datasheet4u.com/download.php?id=53979", "datasheet.pdf");
What makes your case slightly different has nothing to do with the server being written in PHP or anything like that. The link you provided (http://www.datasheet4u.com/datasheet/L/M/7/LM741_NationalSemiconductor.pdf.html) appears to be checking Referer headers when serving the file. This is likely some attempt on their part to prevent what you're trying to do, but it doesn't actually prevent it.
All you need to do is add a Referer header to the request. Something like this:
using (var client = new WebClient())
{
client.Headers.Add("Referer","http://www.datasheet4u.com/datasheet/L/M/7/LM741_NationalSemiconductor.pdf.html");
client.DownloadFile("http://www.datasheet4u.com/download.php?id=53979", "datasheet.pdf");
}
The method for downloading the file is still the same. The server just requires that you send an extra piece of information in the request.

Sending SMS programatically from Asp.net in different Indian languages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to know the C# code or webservice to send SMS in English as well as in different Indian languages such as Hindi, Tamil, etc. I have used mVaayoo to send SMS in English from my application.
I would also like to know how to input the Indian language through my web form. Please suggest any site/gateway that provides the API/webservice for use in sending multi-language SMS.
Follow the below link.
You have to open an account on the free sms sending website as mentioned in the post.
http://reddyinfosoft.blogspot.in/2012/04/sending-sms-via-c-using-way2sms-160by2.html
download the dll that they provide. Include the dll in your code(add reference).

Online tool to convert JSON to C# object format [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm looking for a quick and simple way to convert large JSON objects in a text file to C# object notation for a company project. I would prefer an online solution (similar to jsbeautifier.org) that would take my code, parse it, and return a C# formatted object.
Are there any tools (preferably online) that will do this? I'm hoping not to do this by hand, but writing a script might take time that I don't have right now. (I'm not too well-versed with C# library calls.)
Thank you!
I think following link will help.
Generate c# classes from json
Actually it uses the same project which achitaka-san said in his post. You can create a simple WebService in any host and use it.
This application generates C# classes from a sample JSON text, so you can use strongly typed programming with JSON.
http://jsonclassgenerator.codeplex.com
This is not online, but you just download an EXE, paste your JSON and get a c# class - taht's it.

Categories

Resources