Running a PHP file background


#1

Hello, I am newbie about ionic 2 and I really loved creator and bought it. Now I am programming a mobile app for hobby. I did its PHP backend, everything is working but couldn’t solve some problems in creator.

I am sending a data by Query like; www.abc.com/test.php?data=worldisHere

When you write your data on text, I will send it to this PHP page and it my app will go to next page. And in the next page it will show an information about your string.

Everything is okay till running this PHP page in background. I am sure it is really easy but could’nt find a way to do it. I tried to $http post, get commands but didn’t work on my online creator.

It gives an error on Chrome Console;

XMLHttpRequest cannot load https://… No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘https://creator.ionic.io’ is therefore not allowed access.

If someone can help me, i would really appricate…

Thank you


#2

You backend should have CORS enabled.
Take a look at
http://enable-cors.org/server_php.html


#3

Hello, thank you very much for your quick response…

I tried but it gives me an error like;

Warning: Cannot modify header information - headers already sent by (output started at /home/u6949076/public_html/down1.php:55) in /home/u6949076/public_html/down1.php on line 57

I wonder if it is possible to trig an PHP page from online ionic creator? Or am I giving efford for nothing?

Thanks


#4

The headers added should be at the top of your php script.