Hi,
I just want to know that is it possible to call the url with GET method with some header information added. I can successfully header data with wwwForm and it can be used only for POST method only. I’ve raised several question in Unity answer website and nobody can answer it. I just want to clarify is that possible or not?
Thanks… Please help me
I don’t believe that is supported.
There is the System.Net.WebRequest namespace, but that is only available to you with a standalone build.
I am trying to make it work for iPhone… Any other options to do it work on mobile device such as Android and iPhone?
I think I remember seeing someone mention a fully featured WWW class replacement on the asset store.
Though it wouldn’t be too difficult to roll your own with sockets if a get request is all you’re after. Not as if it is a very complicated endeavor.
Yes… there is a solution called Uniweb in the asset store… but it’s quite expensive and it is just an example of how to use the Ionic_Zlib library and HTTP request class (MIT license) which can get from “http://unityweb.googlecode.com/svn/trunk” … I will be using this library from now on to get the web request calls on Webplayer and other mobile devices 
I’m also interested in these custom classes, but I’m wondering if they do everything necessary for webpage interaction, or at least - do they cover all the functionality provided by Unity’s www and wwwFORM classes?
Also, I’d be curious if you or anyone else is aware of the advantages/disadvantages to using the .NET HTTP classes mentioned in this ‘UnityAnswers’ page:
http://answers.unity3d.com/questions/6780/how-do-i-use-the-www-class-using-a-proxy-server
- over Unity’s own classes or the custom ones? ( besides the proxy issue )
I suppose it comes down to : Which is the best solution out of all three…?
Thanks.
Disadvantage: System.Web will not work anywhere but windows - osx standalone. neither on mobile nor web builds.
Disadvantage: Using a custom one that uses TCP Socket (all custom ones) will not be able to use the webbrowsers caching
Disadvantage: Only WWW can load asset bundles, movies and sound from the outside at all.
Normally you want to use WWW, cause it implements the target platforms native method (NSURLRequest on iOS for example or the browsers own HTTP pipe in the webplayer so you get caching as per browser - if you use anything basing on the TCP socket you have no caching at all anymore)
I see - it seems the WWW class can do most things better, but some things not well enough…
Thanks for the info.
I know this is old, but this might help troubled coders like myself moments ago:
The trick is to create WWW with the (URL, Null data, Header);
I think the documentation says it, but not clearly enough that you can send null data to enforce GET.
2 Likes
Here is a code example that works with a http basic auth. HTH
string URL = “https://somewhere.com/LookupREST/2.0?foo=234asdfas090&countrycode=US”;
Dictionary<string, string> headerInfo = new Dictionary<string, string>();
headerInfo.Add(“Authorization”, “Basic AFDS90AFDS908FDS987F86HG876”);
WWW www = new WWW(URL, null, headerInfo);
yield return www;