Precedence: header in email

There is a RFC 3834 dedicated for automated email responses. In short, it recommends: Send auto-responses only to address contained in the Return-Path header of an incoming message, if it is valid email address. Particularly “<>” (null address) in the Return-Path of the message means that auto-responses must not be sent for this message. When … Read more

PHP get pdf file from base64 encoded data string

Try this piece of code $pdf_base64 = “base64pdf.txt”; //Get File content from txt file $pdf_base64_handler = fopen($pdf_base64,’r’); $pdf_content = fread ($pdf_base64_handler,filesize($pdf_base64)); fclose ($pdf_base64_handler); //Decode pdf content $pdf_decoded = base64_decode ($pdf_content); //Write data back to pdf file $pdf = fopen (‘test.pdf’,’w’); fwrite ($pdf,$pdf_decoded); //close output file fclose ($pdf); echo ‘Done’;

How to set response header in JAX-RS so that user sees download popup for Excel?

You don’t need HttpServletResponse to set a header on the response. You can do it using javax.ws.rs.core.Response. Just make your method to return Response instead of entity: return Response.ok(entity).header(“Content-Disposition”, “attachment; filename=\”” + fileName + “\””).build() If you still want to use HttpServletResponse you can get it either injected to one of the class fields, or … Read more

error: Class has not been declared despite header inclusion, and the code compiling fine elsewhere

You seem to be saying that the code you are showing doesn’t actually produce the compiler error that you are having a problem with. So we can only guess. Here are some possibilities: You could have forgot to include problemclass.h from the file where you are using ProblemClass. You could have misspelled the name of … Read more

HTTP response code after redirect

Your method with get_headers and requesting the first response line will return the status code of the redirect (if any) and more importantly, it will do a GET request which will transfer the whole file. You need only a HEAD request and then to parse the headers and return the last status code. Following is … Read more

404 header – HTTP 1.0 or 1.1?

In PHP you should probably use: header( $_SERVER[‘SERVER_PROTOCOL’].” 404 Not Found”, true ); or even better header( $_ENV[‘SERVER_PROTOCOL’].” 404 Not Found”, true ); (if supported) and thus leave it to the web-server which protocol to use. Actually, if you pass the status code as 3rd parameter, you can pass whatever you want in the 1st … Read more