First of all. Please bear with my questions.
What I am doing is just performing an ajax request which will return a response data of string.
Here\'s my php
Actually Angular looks for a backend server to post the data, so Imagine in your post request is like below
this.http.post('./app/parsers/peenoise.php', '', options).then(val => console.log(val))
It will try to make the post request at the location imagine you are serving angular on localhost:4200
http://localhost:4200/app/parsers/peenoise.php
Now to answer your Questions :
1)./app/parsers/peenoise.php
doesn't work because it's actually trying to find it from your backend service
2)You need to put header('Access-Control-Allow-Origin: *')
whenever you are making an http request to a different server than from the one which your site is currently using, if you don't use that you'll end up with Connection_refused_Error
.
3)If you want to use just angular then there are mockAckends, in-memory-web-api
An example using mockBackEnd is here
Post requires a full or a relative URL to work. You can use:
this.http.post('/parsers/peenoise.php', '', options)