Skip to main content

Posts

Showing posts from December, 2014

Get header information by PHP curl

References:  http://stackoverflow.com/questions/11659460/get-header-information-from-php-curl-post-request http://stackoverflow.com/questions/9183178/php-curl-retrieving-response-headers-and-body-in-a-single-request If you want to get the headers, set the option  CURLOPT_HEADER   to 1, and the HTTP response you get back from   curl_exec()   will contain the headers. You can them parse them for the location. $ch = curl_init ( $url ); curl_setopt ( $ch , CURLOPT_HEADER , 1 ); // return HTTP headers with response curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , 1 ); // return the response rather than output it $resp = curl_exec ( $ch ); list ( $headers , $response ) = explode ( "\r\n\r\n" , $resp , 2 ); // $headers now has a string of the HTTP headers // $response is the body of the HTTP response $headers = explode ( "\n" , $headers ); foreach ( $headers as $header ) { if ( stripos ( $header , 'Location:' ) !== false )

CSS specificity

     A good article      http://htmldog.com/guides/css/intermediate/specificity/ It may not seem like something that important, and in most cases you won’t come across any conflicts at all, but the larger and more complex your CSS files become, or the more CSS files you start to juggle with, the greater likelihood there is of conflicts arising. More Specific = Greater Precedence If the selectors are the same then the  last  one will always take precedence. For example, if you had: p { color : red } p { color : blue } The text in the box of  p  elements would be colored blue because that rule came last. However, you won’t usually have identical selectors with conflicting declarations on purpose (because there’s not much point). Conflicts quite legitimately come up, though, when you have  nested  selectors . div p { color : red } p { color : blue } In this example it might seem that a  p  within a  div  would be colored blue, seeing as a rule to color  p