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
3
Question by Erdroy · Mar 06, 2015 at 09:06 PM · webplayerwwwproblem during runtimewwwform

Unity5 WebPlayer WWWForm working only in Google Chrome

VOTE: http://issuetracker.unity3d.com/issues/www-forms-do-not-work-properly-in-webplayer-unity-5

Hello, when Unity5 has been released, the WWWForm seems to be not working.(Don't sends the fields) but only working correcly on google chrome : /

(Problem explained in code(comments))

Some code:

 //C# Code:
 
   //A method to get WWW instance with fields etc.
   ... WWW GetWeb(string message)
   {
      WWWForm form = new WWWForm();
      string msg = /*encrypt message*/ .Trim();
      form.AddField("input", msg);
      WWW web = new WWW(/*the url*/, form);
      web.threadPriority = ThreadPriority.High;
      return web;
   }
   
 //Download data from www:
   ...IEnumerator Method_Name(...)
   {
      var web = GetWeb("A MESSAGE HERE sth. like: operationId:value1:value2...");
      yield return web;
      
      Debug.Log(web.error);  //Log "Null"
      Debug.Log(web.text);   //Log "ENCRYPTED MESSAGE"
      Debug.Log(/*decrypt: web.text*/);  //Log: "> ERROR"   It isn't excepted : [
   }
 
 //PHP Code:
 
     ...
     if(empty($_POST['input']))
     Die(encrypt("> ERROR"));    // The problem:  $_POST['input'] is empty : / 
     ...




Thanks in advance, Erdroy.

Comment
Add comment · Show 5
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 D3tona · Mar 17, 2015 at 05:22 PM 1
Share

http://issuetracker.unity3d.com/issues/www-post-request-on-webplayer-built-by-unity-5-dot-0-0f2-creates-an-invalid-request

avatar image liortal · Apr 01, 2015 at 04:13 PM 0
Share

Did you get any confirmation that this is a real bug and that someone is working on it ?

avatar image Blazerker · Apr 23, 2015 at 01:31 PM 0
Share

Has anyone found a work-around yet? I urgently need a solution to solve this issue.

avatar image MariuszKowalczyk · Apr 23, 2015 at 02:29 PM 0
Share

Blazerker try this:

Add one binary field to your WWWForm:

 wwwForm.AddBinaryData("binary", new byte[1]);

For me it works.

avatar image Blazerker · Apr 23, 2015 at 03:00 PM 0
Share

I have tried that - it didn't work. When adding it there's an error submitting the form and it doesn't communicate at all.

4 Replies

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

Answer by MariuszKowalczyk · Apr 02, 2015 at 11:19 PM

Workaround:

Add one binary field to your WWWForm:

 wwwForm.AddBinaryData("binary", new byte[1]);

Now everything will work.

Comment
Add comment · Show 8 · 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 clever · Apr 11, 2015 at 04:43 AM 0
Share

doesn't work either, tried it with Unity 5.0.0f4 & 5.0.1f1.. what's taking so long for the Unity Team to fix this???

avatar image liortal · Apr 11, 2015 at 09:33 AM 0
Share

This issue was fixed, it should be available in 5.01p1 i was told

avatar image clever · Apr 11, 2015 at 08:32 PM 0
Share

it's not since I downloaded it yesterday and did 4 hours of testing to no avail. Same exact code works fine when I publish on 4.6 from another system

avatar image liortal · Apr 11, 2015 at 08:51 PM 0
Share

5.0.1 Patch 1, it's not out yet. should be in a few days probably

avatar image liortal · Apr 11, 2015 at 08:51 PM 1
Share

5.0.1 Patch 1 - this release is not out yet (probably in a few days)

Show more comments
avatar image
3

Answer by clever · Apr 23, 2015 at 02:42 PM

So 5.0.1p1 "may" have fixed the issue, sadly the game doesn't load on webplayer. AND now Chrome stopped support for Unity WebPlayer so we're up sh-t creek without a paddle.. really depressing

Comment
Add comment · Show 1 · 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 Helical · May 06, 2015 at 05:24 PM 0
Share

Vote up for sh-t creek without a paddle./

avatar image
1

Answer by Gselivanof · Mar 08, 2015 at 08:20 PM

Check your other browser UnityWeb player and Java Plug-in. If it doesn't help send me back.

Comment
Add comment · Show 1 · 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 Erdroy · Mar 09, 2015 at 06:22 PM 0
Share

Firefox and IE doesn't work... Only Google Chrome works. But, it's a some type of bug/issue I think. http://issuetracker.unity3d.com/issues/www-post-request-on-webplayer-built-by-unity-5-dot-0-0f2-creates-an-invalid-request

avatar image
1

Answer by Blazerker · Apr 24, 2015 at 01:30 PM

This workaround worked for me...

In PHP

 if (empty($_POST)) 
 { 
     $data = file_get_contents('php://input'); 
     $data = substr($data,strrpos($data,"\n")); 
     $vars = explode("&",$data); 
     $_POST = array(); 
     for ($i = 0; $i < count($vars); $i++) 
     { 
         list($key, $value) = split("=", $vars[$i],2); 
         if(strlen(trim($key))>0) 
         { 
             $key=preg_replace('/[\n\r]/', '', $key); 
             $value=preg_replace('/[\n\r]/', '', $value); 
             $_POST[$key]=$value; 
         } 
     } 
 } 

http://issuetracker.unity3d.com/issues/www-post-request-on-webplayer-built-by-unity-5-dot-0-0f2-creates-an-invalid-request

Update:

The above code works in Firefox, but not in Safari. It seems the raw data is intact and identical in both, but the way the $_POST variable is formed seems to differ between the two. The only thing I know of that recently changed is the release of PHP 5.6 and I have a hunch it has something to do with $HTTP_RAW_POST_DATA and always_populate_raw_post_data being depreciated... Maybe someone with more knowledge of this can verify...

By forcing php to always interpret php://input and omitting the if(empty($_POST)) statement seems to fix the bug, but I still need to test it from mobile compilations.

 $data = file_get_contents('php://input'); 
 $data = substr($data,strrpos($data,"\n")); 
 $vars = explode("&",$data); 
 $_POST = array(); 
 for ($i = 0; $i < count($vars); $i++) 
 { 
     list($key, $value) = split("=", $vars[$i],2); 
     if(strlen(trim($key))>0) 
     { 
         $key=preg_replace('/[\n\r]/', '', $key); 
         $value=preg_replace('/[\n\r]/', '', $value); 
         $_POST[$key]=$value; 
     } 
 }



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

8 People are following this question.

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

Related Questions

WWW zero sized post buffer error Standalone 1 Answer

Any caching options available for things dynamically loaded by WebPlayer? 0 Answers

Webplayer can not read file from website 1 Answer

OnApplicationQuit web player save data using WWW 1 Answer

GET Request Wrapper 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