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;








1















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?










share|improve this question
























  • 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


















1















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?










share|improve this question
























  • 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














1












1








1








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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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


















  • 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

















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













1 Answer
1






active

oldest

votes


















0














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.
...





share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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.
    ...





    share|improve this answer



























      0














      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.
      ...





      share|improve this answer

























        0












        0








        0







        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.
        ...





        share|improve this answer













        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.
        ...






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 9 at 22:46









        domdambrogiadomdambrogia

        8111022




        8111022





























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

            Posting a File and Associated Data to a RESTful WebService preferably as JSON2019 Community Moderator ElectionREST URI convention - Singular or plural name of resource while creating itUploading both data and files in one form using Ajax?How do I upload a file with metadata using a REST web service?REST API - file (ie images) processing - best practicesSpring: JSON data and file in the same requestREST API Put large dataPosting a file and JSON data to Spring rest serviceRESTful Web Service Upload/Download Large Data With JSONREST API Design sending JSON data and a file to the api in same requestPost JSONArray to REST servicePUT vs. POST in RESTParsing values from a JSON file?JavaScript/jQuery to download file via POST with JSON dataHow do I upload a file with metadata using a REST web service?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?Separate REST JSON API server and client?what's the correct way to send a file from REST web service to client?How do I write JSON data to a file?What is “406-Not Acceptable Response” in HTTP?REST API - file (ie images) processing - best practices

            How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page