php and curl: get headers from response

by prettyscripts on 2011-08-23 12:28:00 • Leave a comment »

phpcode

for beinners, please check this example on how to use curl library. to include headers in response, setĀ CURLOPT_HEADER to 1 in curl options. ie, curl_setopt_array($ch, array( ... CURLOPT_HEADER => 1, ... ); to include headers o… more »

Tags: body, curl, header, http, php, response

http status codes

by prettyscripts on 2008-01-15 14:41:32 • Leave a comment »

bookmarkhtml

some common status returned by http/1.1 (taken from this document).200 OKThe request has succeeded. 301 Moved PermanentlyThe requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the retur… more »

Tags: header, http, status

php: stream download

by prettyscripts on 2007-11-27 22:42:37 • Leave a comment »

php

a general php code to download any type of file: header("Content-Type: application/octet-stream"); header("Content-Length: " . filesize($filename)); header("Content-Disposition: attachment; filename=\"$filename\""); readfile($filename); co… more »

Tags: download, header, php