application/json all requests going to 403

236
August 07, 2017, at 4:19 PM

Through postman, I am posting data to specific URL like site.com/read_request.php. When I am selecting raw data application/xml it gives me output as expected but with application/json it gives me 403

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /tomy/url
on this server.</p>
<hr>
<address>Apache/2.2.15 (Red Hat) Server at ......com Port 80</address>
</body></html>

I tried with adding

header('content-type: application/json; charset=utf-8');
header("access-control-allow-origin: *");

but no luck, from server side can we block only the application/json requests? If yes how to debug?

Answer 1

Add a .htaccess file in the folder where you need access on the server.

In that .htaccess file add:

Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

This makes sure that you can post things to it. But others can also, so be careful!

Rent Charter Buses Company
READ ALSO
Bad performance in the cURL call on the same server

Bad performance in the cURL call on the same server

Why just few concurrency can cause block when cURL call on the same server

210
What is the best online quiz exam system using only php and mysql?Supported on 000webhost? [on hold]

What is the best online quiz exam system using only php and mysql?Supported on 000webhost? [on hold]

Help to find out pleaseand give me the whole project source code

204
how to get next month&#39;s date and it&#39;s not related to current month date in MySQL

how to get next month's date and it's not related to current month date in MySQL

I have three columns in my table, future 3 months like fistdate(next month), secondate(+2 next month) and thirdate(+3 next month) which are DATE typesI want to save my dates as follows 09/09/2017, 09/10/2017 and 09/11/2017 and current month is 07/08/2017...

237
SoftDelete php5 without framework [on hold]

SoftDelete php5 without framework [on hold]

hello how can I use SoftDelete in php5 without frameworkI need to delete a line from database but not physical

292