Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by markmeister · Aug 03, 2011 at 03:18 PM · webplayersavephpfile-io

WebPlayer call a server php script issue

Hi, i'm working to a facebook game that saves and reads .txt files on the server. I've created 2 php script to read/write a file. Now, when i run the scene that save the file, there aren't problems: the file is correctly saved, but when i try to read it, the webplayer doesn't call the "readFile.php". I'm sure of this beacause i tried to call it manually and it works well: it returns the file and creates a log file on server. I've also created a windows version of my game and it works well: it read the remote file and do what it's developed for. The problem is on webplayer, it seems can't call the readFile.php script.

Thanks to anyone who responds and sorry for my bad english.

That is how i make my request:

 WWW request = new WWW("http://www.hostname.it/FB-Game/readFile.php?fname=" + fileName);
 StartCoroutine(WaitForRequestDone(request));

the WaitForRequestDone() function:

 public IEnumerator WaitForRequestDone(WWW www)
 {
     yield return www;
     string file = www.text;
     string[] tempString = file.Split('*');
     times = new float[tempString.Length];
     messages = new string[tempString.Length];
     for (int i = 0; i < tempString.Length-1; i++)
     {
         tempLine = tempString[i].Split(':');
         times[i] = System.Convert.ToSingle(tempLine[0]);
         messages[i] = tempLine[1] + ":" + tempLine[2];

         if (tempLine.Length > 3)
         {
             messages[i] += ":" + tempLine[3];
             if (tempLine.Length > 4)
                 messages[i] += ":" + tempLine[4];
         }
         
     }
     tempIndex = 0;
 }

This code works on a stand alone application and i use almost the same commands to write a file (and it works fine).

Comment
Add comment · Show 2
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 Graham-Dunnett ♦♦ · Aug 03, 2011 at 03:26 PM 0
Share

You might care to show some code from your Unity game so we can see what you are doing.

avatar image markmeister · Aug 03, 2011 at 03:37 PM 0
Share

I've edited the question ;)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DanMarionette · Aug 19, 2011 at 11:04 AM

I've had a look at the scripting reference and it mentions the following,

Note: The security sandbox present in web-player builds prevents you from accessing content not hosted the server where the webplayer is hosted.

This may be where you are having trouble.

UPDATE: I have just been playing with this myself for the first time and you can host your game on a different server than the web server but you need to have a crossdomain.xml file in the root of the web server your fetching the data from.

Info can be found here.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Incremental Filename if it exists 3 Answers

How do I create multiple save files and make it work? 2 Answers

HOW Unity store game saves? Are mySQL a valid option to store such data? How about javascript framework or php? 0 Answers

Using PHP to generate objects or list in Unity with C# 2 Answers

Webplayer Facebook game- is a PHP script and a Unity script sufficient? 0 Answers


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