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 Mefistofelos · Aug 06, 2011 at 01:05 PM · editorphpwww classcrossdomain.xmllocalhost

How can I read a php file in localhost or remote from unity editor

Hi

I red this on lots of links, but I cant make it work for me.
What I want to do is to use this peace of code and use it to read a file on my localhost.
I use PHP in localhost. I`d like to make some sort of communication with unity, but that is not important at this point. I`d just like to make my 2 apps talks somehow from editor.

    var w = WWW(url);   yield w;
     if (w.error != null) { 
       print(w.error); 
    } else { 
       print("Test ok"); 
       formText = w.text; 
       print(formText);
    } 

I have managed to make a call only like this: I build a project, move it to my localhost (http://localhost/unity/test/WebPlayer.html), and from there make a call, and it works remotely, my online(or offline) files are updated when I make a call, but I can`t make it work from within unity3d editor.
Can that be done at all?

Thanks in advance,
this is my first post, so I might have posted it wrong, on wrong place, etc.

EDIT: When I set a default build as "standalone", I can communicate with server through unity editor.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by jahroy · Sep 14, 2011 at 02:32 AM

Have you configured the WWW Security Emulation settings in the Editor?

My understanding is that the Editor will attempt to emulate the security restrictions imposed on the web player.

If you go here:

 Edit -> Project Settings -> Editor

You can then specifiy the URL where your game will be hosted in the Inspector.

This will allow the Editor to simulate the security restrictions that will be imposed on your game if you publish it to that address.

This does not explain why you wouldn't be able to access a php script running on the same host as a published game.

http://unity3d.com/support/documentation/Manual/Security%20Sandbox.html

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 sneftel · Aug 06, 2011 at 05:46 PM

It's possible that the Unity Editor is being blocked by your computer's firewall. Check the firewall configuration to make sure there's an exception for it.

Comment
Add comment · Show 2 · 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 Mefistofelos · Aug 06, 2011 at 06:20 PM 0
Share

I found out later on today that when I set a default build (in unity options) to stand alone or windows build, it works, sends data to my online/offline server. It dont work when default build is set to webPlayer tho. Should it work?

avatar image Wulfeous · Sep 14, 2011 at 12:49 AM 0
Share

any suggestions on this yet? Even my uploaded webplayer wont connect to the php in same directory. I might just be doing it wrong.. I tried url= http://address.com/scores.php, http://localhost/scores.php, just /scores.php, nothing. worked in stand alone for me too. always asks for the crossdomain.xml which doesnt work.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem reaching highscore board - crossdomain.xml issue? 1 Answer

WWW doesn't work on localhost eventhough crossdomain.xml exists 1 Answer

WWW Class is acting up 1 Answer

Is interraction between EditorWindow and php file possible? 1 Answer

How to access a PHP script on XAMPP with the use of Android device? 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