Posts Tagged ‘HTTP’

ASP.NET: Disable browser and proxy caching for aspx resources

The following lines of code can be put into a .aspx file to prevent the resource from being cached on clients or proxies: <% Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); %> To prevent caching, these lines of code change the header of the server’s HTTP response by setting the following values: Cache-Control: no-cache, no-store Expires: -1 Pragma: no-cache You [...]

Read more…

PHP 5: Send HTTP post request with file_get_contents

The following code snippet shows an easy way how to send a HTTP post request using the PHP function file_get_contents: $url = ‘http://server.com/path’; $data = array(’key1′ => ‘value1′, ‘key2′ => ‘value2′)   // use key ‘http’ even if you send the request to https://… $options = array(’http’ => array( ‘method’ => ‘POST’, ‘content’ => http_build_query($data) [...]

Read more…