- Home /
Posting raw XML data to web - no parameter name
The WWWForm requires a AddField(parameter name, value). Right now, I am trying to interface a web API that just expects XML to be posted to it. Is there a way to just post xml data from Unity without explicitly binding it to an AddField parameter?
Answer by Waz · Aug 30, 2011 at 04:13 AM
Use the WWW constructor that takes plain bytes of postData, rather than taking a WWWForm.
how do you convert a string or char array to a byte array... i tried string.ToCharArray() - but unity 3.4 has issues taking char arrays as byte arrays "The type 'UnityEngine.WWW' does not have a visible constructor that matches the argument list '(String, char[])'."
Answer by Bunny83 · Aug 30, 2011 at 04:16 AM
Yes you can, just don't use WWWForm because it's designed to represent a web-formular and therefore only contains fields.
If you read the documentation of WWW carefully you will find multiple constructors. There are two that accept a byte array as raw-post data.
how do you convert a string or char array to a byte array... i tried string.ToCharArray() - but unity 3.4 has issues taking char arrays as byte arrays "The type 'UnityEngine.WWW' does not have a visible constructor that matches the argument list '(String, char[])'."
That might help:
googled in less than 5 Sec.
Your answer
Follow this Question
Related Questions
PHPSESSID with Unity 2 Answers
Sending data to a .php service using Unity's WWW? 1 Answer
Sending cookie to XML-RPC protocol 0 Answers
How do I add a header and a file at the web request at the same time? 0 Answers
PUT with WWWform 3 Answers