Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Access Localhost with network.request
Started by vonncc123 Jun 04 2018 11:36 PM

3 replies to this topic
network localhost
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

vonncc123

[GLOBAL: userInfoPane.html]
vonncc123
  • Contributor

  • 219 posts
  • Corona SDK

Good day, How can I access my .json file from my localhost, I want to get and update it whenever I can from the app, but it appears that I can't get my file from the localhost. I tried using PHP, but still it won't let me access

my localhost URL is like this "http://some_ip_address._some._some"

What seems to be the problem, the html content is just a simple HELLO, and also the PHP is just a simple HELLO too, but the event.resposne always gives me, some long HTML code, and the PHP is just a 405 error.

 

Thanks in advance



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 23,917 posts
  • Corona Staff

Do you have a web server running on your local computer?  localhost (IP address 127.0.0.1) isn't some arbitrary URL. It's either going to be http://localhost/rest_of_url or http://127.0.0.1/rest_of_url.  You can't use PHP unless you have setup a web server running locally on your computer and installed it to use PHP.

 

Can you provide more details about how you have a web server configured on your local computer?

 

Rob



[TOPIC: post.html]
#3

vonncc123

[GLOBAL: userInfoPane.html]
vonncc123
  • Contributor

  • 219 posts
  • Corona SDK

Actually what I did, is just put the whole PHP project on the local server, and I just tried accessing it via it's IP address.



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 23,917 posts
  • Corona Staff

Can you access the URL in a web browser (should check in Safari on a Mac or Internet Explorer, not Edge on Windows)?

 

Rob




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: network, localhost