Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Thet Naing Swe · May 11, 2011 at 02:10 AM · wwwgetheader

Adding header info to www "GET" method.

Is that possible to add header information in the GET method of the built in www request. I've done the following code in Corona and what's the similar version to Unity. WWWform can add headers and it can be used only for POST method.

gamer info local params = {}; params.headers = headers; params.body = "email=" .. tempRivalID .. "&password=" .. tempPwd;

network.request( "http://happycat.xtremebit.net/gpi/gamer?session_key=" .. sessionKey, "GET", gamerInfoListener, params);

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
10
Best Answer

Answer by delsolu · Sep 19, 2013 at 06:22 AM

The key is leaving "postData" parameter to null. From Unity3D WWW reference

The WWW class will use GET by default and POST if you supply a postData parameter.

So this one works for me:

 var form = new WWWForm();
 var headers = new Hashtable();
 headers.Add("Header_key", "Header_val");
 www = new WWW("http://localhost/getpostheaders", null, headers);
 yield return www;
 Debug.Log("2. " + www.text);
Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image GeorgeRigato · Nov 22, 2013 at 02:48 PM 0
Share

Thanks for the input! Saved my day. All over the place you got folks saying Unity can't make GET requests with header.

avatar image GuyTidhar · Nov 23, 2013 at 07:44 PM 0
Share

Because this feature did not originally exist. Notice I, myself said currently, which was true at that time.

avatar image GeorgeRigato · Nov 23, 2013 at 07:54 PM 1
Share

I see. At the time that statement was true. But searching now it may be misleading if you dont look at the post date. But thanks for the input too!

avatar image GuyTidhar · Nov 24, 2013 at 08:37 AM 0
Share

You're 100% right, but I'm guessing until Google search uses some algorithm to make obsolete answers in forums, at least technical ones, less apparent, these will continue to plague us.

avatar image Syl3nce · Jan 28, 2016 at 02:57 PM 0
Share

Thanks you :) ! You save my day !!

Show more comments
avatar image
0

Answer by GuyTidhar · Jun 23, 2011 at 09:03 AM

unity currently does not support custom headers for a GET request.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Simon Wittber · Feb 08, 2012 at 03:23 AM

UniWeb replaces WWW and will allow this.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Custom Header with WWW Get 0 Answers

GET Request Wrapper 1 Answer

See Request of WWW or UnityWebRequest, 403 error only from android in a specific url (GET) 2 Answers

HTTP Response Headers? 3 Answers

How do I post a cURL request from Unity? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges