http

php: how to return an HTTP 500 code on any error, no matter what

Hi guys. I'm writing an authentication script in PHP, to be called as an API, that needs to return 200 only in the case that it approves the request, and 403 (Forbidden) or 500 otherwise. The problem I'm running into is that php returns 200 in the case of error conditions, outputting the error as html instead. How can I make absolutel...

How do I log the raw HTTP headers with a PHP script?

I'm using a cURL script to send POST data through a proxy to a script and I want to see what raw HTTP headers the cURL script is sending. List of things I've tried: echo curl_getinfo($ch, CURLINFO_HEADER_OUT) gives no output. file_get_contents('php://input') gets some HTTP headers but not all. print_r($_SERVER) also gets some HTTP head...

How do I connect to the internet in blackberrires app without paying BIS?

I was told that in order for my blackberry app to connect to my service (a server) it needs to be done over BIS. Otherwise it will not work with a large number of bb users as they actually have a "data plan", they just have a BIS plan. And for them to connect to my service, I have to pay for the expensive alliance program. Is this true? ...

ASP.NET HTTPHandler not throwing exception when one is expected

I have an HttpHandler class (implements IHttphandler) where the path defined for the handler in web.config is *.jpg. I am requesting a Jpg image in my page. Within the HTTP Handler I am writing to a file in the filesystem. By mistake I was trying to write to a non existant directory. This should have thrown an exception but the execution...

What's the header file for BasicHttpRequest

What's the header file for BasicHttpRequest? I am using Apache HttpComponents. I'm trying to make a simple program, but I am getting this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.http.impl.client.AbstractHttpClient.(AbstractHttpClient.java:159) at org.ap...

Using a specific network interface for a WININET HTTP request

Is there a way to specify which local network interface to use when using the WININET interface for an outgoing HTTP request? I know how to do it with WINSOCK (using bind()), but I can't find an equivalent way to do it using WININET. ...

Send an Array with an HTTP Get

How can i send an Array with a HTTP Get request? I'm Using GWT client to send the request. ...

Reuse and add to 500 error to get better stats from soap

Hi We deliver a huge amount of data based on soap requests. Whenever a request fails, soap specifies a 500 error must be returned with a response object telling about the error. Now I know for a fact that MANY of our responses actually should be 400 errors due to bad requests, but we are not allowed to send those. Is it possible to add ...

Recommendation for free sms api for testing purpose

I want to test my application and for that purpose I need some free SMS API that can work globally. This is just for testing purpose and my requirement is just for 15-20 sms. I tried lot of sms apis given by google and mentioned in stackoverflow but none helped. One helped smsglobal but after sending 2 sms and it stopped working . An...

How to return an image in an HTTP response with CherryPy

I have code which generates a Cairo ImageSurface, and I expose it like so: def preview(...): surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) ... cherrypy.response.headers['Content-Type'] = "image/png" return surface.get_data() preview.exposed = True This doesn't work (browsers report that the image has...

Is gzip compression useful for mobile devices?

Hi SO, I'm wondering if anyone has a clue on whether the gzip compression is as much useful on mobile devices than it is on a desktop computer. Will the phone use more battery? Or will it save some because of the bandwidth saving? Will the page page load faster or is the uncompress process slow on those limited devices? Does the compr...

WCF configuration for WebHttpBinding(Restful) for supporting both HTTP and HTTPS

We are using AJAX Cascading dropdown and AutoComplete functionality with Restful WebService Services providing data. With one endpoint(non-secured) eveything was working fine, until we tried same web page with https. Our Webappplication needs to support both. Our of very few articiles/blogs on this issue I found 2 which applies to my req...

HTTP status code for "success with errors"?

I've poked around a bit, but I don't see an HTTP status code for when a request's succeeds, but there is an error after the "point of no return". e.g., Say you process a request, its committed to the database, but while returning the result you run of memory, or encounter a NPE, or what have you. It would have been a 200 response, but ...

Selectively Redirecting HTTP requests to HTTPS requests in ASP.NET

What's the simplest and most effective way to selectively redirect HTTP requests to your ASP.NET page to its HTTPS equivalent? For example, if my page site URL is http://www.somesite.com, I want to redirect some (or all) page requests to https://www.somesite.com. What's the easiest way to do that? ...

Protect HTTP request from being called by others

Hi, I have an Android application from which I want to upload some data to a database on my web server. As the MySql java library has a size of about 5 mb, I don't want to include it with the application. So I'll make a HTTP request for a php script and send the data with the URL as parameters. How do I make sure that only I can call th...

What could be the best solution to avoid the conflict of http and https popups in IE?

What could be the best solution to avoid the conflict of http and https popups in IE? I have many Secured connection pages where i face this popup in IE, I want to handle it how to do that? ...

JSP session for each IP address or for each browser

I want to know whether one session is been created for each IP address or for each browser instance? I opened my JSP application in three browser windows. It creates three different sessions? Suppose I want to use a single session for multiple instance of browser, is it possible or not? ...

Can an authentication via HTTP over IIS be encrypted (without SSL)?

I'm accustomed to *nix servers and if we wanted a completely secure sign in screen, we (as far as I am aware) are to use SSL via HTTPS. Our overseeing organization at work use Windows Servers for serving web pages. On one such page they are authenticating network credentials. This page is using HTTP, and what appears to be Basic Auth (a ...

How to make PHP set HTTP status code to 500 automatically in case of any error condition? (including those that cannot be handled by user)

Hi all. I am running Apache 2.2.15 with PHP 5.3.2, 'display_errors' disabled, 'display_startup_errors' disabled, 'log_errors' enabled. At my setup (so I consider it a norm), PHP aborts on fatal errors, which is good, and sets HTTP status code to 500. Fatal errors include E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR and...

Http connection timeout on Android not working

I'm writing an application that connects to a webservice and I don't want it to wait too long if it can't get a connection. I therefore set the connectionTimeout of the httpparams. But it doesn't seem to have any effect whatsoever. To test I turn of my WLAN temporarily. The application tries to connect for quite some time (way more than...