I have a WAMP server on my localhost, and I'm trying to run the php file inside of it, through my react native app in order to store user information. I know I needed to use my localhost's IPv4, and the port number, then the file location, but I still keep on getting: 'Possible Unhandled Promise Rejection (id: 0): TypeError: Network Request failed', while running my app on an ios device on the expo app.
I've tried making it an https instead of http, but i still keep on getting the same error, I've copy pasted the link into google chrome and it runs the php file, but when i do it on another device on the same network, it takes a very long time to connect but then it times out right away, and yes, my server is online.
fetch('http://[My server's IPv4 address]:80/Fetcher/Users.php', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: this.state.username,
password: this.state.password,
})
}).then((response) => {response.json()}).then(fullResponse => {
console.warn(fullResponse);
console.warn('out');
}).catch(err => console.error(err));
I expected it to take in the username and password and store them on the table I created on my WAMP server's table under the schema I've created.
What happens instead is I get a Network request failed error on my app