How do I link php slim with IonicHow can I prevent SQL injection in PHP?PHP: Delete an element from an arraystartsWith() and endsWith() functions in PHPHow do I get PHP errors to display?How Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How do I check if a string contains a specific word?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?Ionic 3 Http API Error
What does it mean to describe someone as a butt steak?
Rock identification in KY
Convert two switches to a dual stack, and add outlet - possible here?
Replacing matching entries in one column of a file by another column from a different file
Is it unprofessional to ask if a job posting on GlassDoor is real?
How can I make my BBEG immortal short of making them a Lich or Vampire?
meaning of に in 本当に?
Watching something be written to a file live with tail
Why can't we play rap on piano?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
Is it possible to run Internet Explorer on OS X El Capitan?
What's the output of a record needle playing an out-of-speed record
How do I deal with an unproductive colleague in a small company?
How is it possible to have an ability score that is less than 3?
A case of the sniffles
Why is 150k or 200k jobs considered good when there's 300k+ births a month?
What would happen to a modern skyscraper if it rains micro blackholes?
How much of data wrangling is a data scientist's job?
Why can't I see bouncing of a switch on an oscilloscope?
Languages that we cannot (dis)prove to be Context-Free
Malformed Address '10.10.21.08/24', must be X.X.X.X/NN or
Can I make popcorn with any corn?
DC-DC converter from low voltage at high current, to high voltage at low current
Can a vampire attack twice with their claws using Multiattack?
How do I link php slim with Ionic
How can I prevent SQL injection in PHP?PHP: Delete an element from an arraystartsWith() and endsWith() functions in PHPHow do I get PHP errors to display?How Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How do I check if a string contains a specific word?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?Ionic 3 Http API Error
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
this is the code in ionic to link to my slim api:
postData(credentials, type)
return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);
credentials is my data and type is"signup"
and this is the slim php code tp match the route
$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);
when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory
This is the error showing on the command prompt where i started the the php server
1
how to fix this?
php ionic-framework slim
add a comment |
this is the code in ionic to link to my slim api:
postData(credentials, type)
return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);
credentials is my data and type is"signup"
and this is the slim php code tp match the route
$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);
when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory
This is the error showing on the command prompt where i started the the php server
1
how to fix this?
php ionic-framework slim
Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.
– domdambrogia
Mar 9 at 1:08
Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080
– Patrick Sharma
Mar 9 at 1:54
Then you should be usingthis.http.post("http://localhost:8080/api/signup"
, correct?
– domdambrogia
Mar 9 at 2:08
I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web
– Patrick Sharma
Mar 9 at 3:13
add a comment |
this is the code in ionic to link to my slim api:
postData(credentials, type)
return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);
credentials is my data and type is"signup"
and this is the slim php code tp match the route
$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);
when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory
This is the error showing on the command prompt where i started the the php server
1
how to fix this?
php ionic-framework slim
this is the code in ionic to link to my slim api:
postData(credentials, type)
return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);
credentials is my data and type is"signup"
and this is the slim php code tp match the route
$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);
when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory
This is the error showing on the command prompt where i started the the php server
1
how to fix this?
php ionic-framework slim
php ionic-framework slim
edited Mar 9 at 2:02
Patrick Sharma
asked Mar 9 at 1:03
Patrick SharmaPatrick Sharma
62
62
Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.
– domdambrogia
Mar 9 at 1:08
Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080
– Patrick Sharma
Mar 9 at 1:54
Then you should be usingthis.http.post("http://localhost:8080/api/signup"
, correct?
– domdambrogia
Mar 9 at 2:08
I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web
– Patrick Sharma
Mar 9 at 3:13
add a comment |
Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.
– domdambrogia
Mar 9 at 1:08
Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080
– Patrick Sharma
Mar 9 at 1:54
Then you should be usingthis.http.post("http://localhost:8080/api/signup"
, correct?
– domdambrogia
Mar 9 at 2:08
I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web
– Patrick Sharma
Mar 9 at 3:13
Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.
– domdambrogia
Mar 9 at 1:08
Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.
– domdambrogia
Mar 9 at 1:08
Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080
– Patrick Sharma
Mar 9 at 1:54
Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080
– Patrick Sharma
Mar 9 at 1:54
Then you should be using
this.http.post("http://localhost:8080/api/signup"
, correct?– domdambrogia
Mar 9 at 2:08
Then you should be using
this.http.post("http://localhost:8080/api/signup"
, correct?– domdambrogia
Mar 9 at 2:08
I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web
– Patrick Sharma
Mar 9 at 3:13
I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web
– Patrick Sharma
Mar 9 at 3:13
add a comment |
1 Answer
1
active
oldest
votes
After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public
directory like in the documentation.
You should be able to do one of two things:
You can navigate to the public
directory - .../htdocs/slimapp/public
- and start the PHP server there - php -S 127.0.0.1:8080
Or you can specify the document root of the server (just like in the docs posted) with the -t
flag.
php -S localhost:8080 -t public public/index.php
If you run php --help
you can see all of the flags available with the php
binary.
php --help
...
-S <addr>:<port> Run with built-in web server.
-t <docroot> Specify document root <docroot> for built-in web server.
...
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072987%2fhow-do-i-link-php-slim-with-ionic%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public
directory like in the documentation.
You should be able to do one of two things:
You can navigate to the public
directory - .../htdocs/slimapp/public
- and start the PHP server there - php -S 127.0.0.1:8080
Or you can specify the document root of the server (just like in the docs posted) with the -t
flag.
php -S localhost:8080 -t public public/index.php
If you run php --help
you can see all of the flags available with the php
binary.
php --help
...
-S <addr>:<port> Run with built-in web server.
-t <docroot> Specify document root <docroot> for built-in web server.
...
add a comment |
After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public
directory like in the documentation.
You should be able to do one of two things:
You can navigate to the public
directory - .../htdocs/slimapp/public
- and start the PHP server there - php -S 127.0.0.1:8080
Or you can specify the document root of the server (just like in the docs posted) with the -t
flag.
php -S localhost:8080 -t public public/index.php
If you run php --help
you can see all of the flags available with the php
binary.
php --help
...
-S <addr>:<port> Run with built-in web server.
-t <docroot> Specify document root <docroot> for built-in web server.
...
add a comment |
After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public
directory like in the documentation.
You should be able to do one of two things:
You can navigate to the public
directory - .../htdocs/slimapp/public
- and start the PHP server there - php -S 127.0.0.1:8080
Or you can specify the document root of the server (just like in the docs posted) with the -t
flag.
php -S localhost:8080 -t public public/index.php
If you run php --help
you can see all of the flags available with the php
binary.
php --help
...
-S <addr>:<port> Run with built-in web server.
-t <docroot> Specify document root <docroot> for built-in web server.
...
After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public
directory like in the documentation.
You should be able to do one of two things:
You can navigate to the public
directory - .../htdocs/slimapp/public
- and start the PHP server there - php -S 127.0.0.1:8080
Or you can specify the document root of the server (just like in the docs posted) with the -t
flag.
php -S localhost:8080 -t public public/index.php
If you run php --help
you can see all of the flags available with the php
binary.
php --help
...
-S <addr>:<port> Run with built-in web server.
-t <docroot> Specify document root <docroot> for built-in web server.
...
answered Mar 9 at 22:46
domdambrogiadomdambrogia
8111022
8111022
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072987%2fhow-do-i-link-php-slim-with-ionic%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.
– domdambrogia
Mar 9 at 1:08
Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080
– Patrick Sharma
Mar 9 at 1:54
Then you should be using
this.http.post("http://localhost:8080/api/signup"
, correct?– domdambrogia
Mar 9 at 2:08
I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web
– Patrick Sharma
Mar 9 at 3:13