I'm getting JavaScript error when i'm sending post request using postman

<?php
header("Content-Type:application/json");



    if(isset($_POST["body"]) && isset($_POST["subject"])){
        try {
   
            $response["msg"] = "sended successfully";
            echo json_encode($response);
          }
          
          //catch exception
          catch(Exception $e) {
            $response["msg"] = "sending failed";
            echo json_encode($response);
          }
        
    }
?>

This is a simple code which i have written for testing purpose but when i send request using postman i got an error back instead of the response i tested this on my local environment and everything is working fine.

<html>

<body>
	<script type="text/javascript" src="/aes.js"></script>
	<script>
		function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("5d5c2548bff254390dd62aa453ef17cd");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://isuz3str.epizy.com/sendmail_api/index.php?i=1";
	</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser
		with Javascript support</noscript>
</body>

</html>

Can’t we deploy an PHP API code for simple response? So that we can use this API with our other projects?

Hello there,

Well most APIs are blocked and not supported here. And also that error you got on your screenshot is because of the security system here on free hosting called “aes.js” which ensures only web browsers is able to access your site.

For more information regarding the security system, please refer to this knowledge base article:

3 Likes

Come on man use PHP its much simple and secure.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.