• 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
1
Question by TheFrobster · Jun 14, 2011 at 07:15 PM · ioswwwdownloadwebphp

WWW Class behaves strangely on iOS

Hi,

I'm trying to execute a php script via the WWW-class in order to save $$anonymous$$ghscores online. My code looks somet$$anonymous$$ng like t$$anonymous$$s:

 WWW download = new WWW( "http://www.serverxy.net/game/script.php?cmd=scores" );

It works fine on PC and Mac, but on iOS devices there seems to be a problem: The WWW-class doesn't execute the php script defined in the URL. Instead it downloads the index.htm found on the root-level of the server.

Thanks in advance!

Comment
Add comment · Show 1
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 BerggreenDK · Dec 21, 2011 at 07:10 PM 0
Share

3 Replies

· Add your reply
  • Sort: 
avatar image
1

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

The WWW class doesn't let you handle HTTP redirects yourself. UniWeb is a better HTTP api and will let you do t$$anonymous$$s.

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 Jean-Fabre · Apr 09, 2013 at 09:38 AM 0
Share
avatar image
0

Answer by Dreamora · Dec 26, 2011 at 05:08 PM

The line there does not execute anyt$$anonymous$$ng like that. Could you please post the rest of the code so its ensured you correctly execute WWW etc? (I ask cause I've seen people using WWW outside of coroutines w$$anonymous$$ch at times can work on the desktop or webplayer but will always fail on mobile where WWW will never immediately return - WWW always must be in coroutines and yield until they are done)

Just to mention that in case you search in other places: the WWW call never executes the php, its the apache server that would do it, all that WWW does is tell the server to do that and then it will return the echo that your PHP outputs, if there is one. But thats only a detail and not of relevance in t$$anonymous$$s case as it works on PC / Mac

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 davedev · Jan 19, 2012 at 01:45 PM

The call is probably getting redirected to "http://index.htm" because there's somet$$anonymous$$ng wrong with "http://www.serverxy.net/game/script.php?cmd=scores" or maybe iOS mangles the url somehow, but the server probably gets a url for an invalid page and redirects it to index.htm. Does "http://www.serverxy.net/game/script.php?cmd=scores" work from the browser? Do you have access to the server logs that you can look at? Try a test php file at simpler url and see if that works.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

Invoke www.error in PHP 1 Answer

iOS download files and store to local drive 4 Answers

www.texture different in editor and on webplayer 1 Answer

`Recv failure: Connection was reset` In editor? (platform set to Android NOT WebPlayer) 0 Answers

About renting the host for the game 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