PHP – CURL Authentication

MacBook avec code sur un bureau

To authenticate a cURL request in PHP, the option to know is CURLOPT_USERPWD. It sends a username / password pair in the user:password format. Basic authentication $ch = curl_init(‘https://exemple.com/api’); curl_setopt($ch, CURLOPT_USERPWD, ‘utilisateur:motdepasse’); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $reponse = curl_exec($ch); if ($reponse === false) { throw new RuntimeException(curl_error($ch)); } curl_close($ch); Setting … Read more

Categories PHP

jQuery File Upload – Basic solution with a callback

MacBook avec code sur un bureau

jQuery-File-Upload How to use the basic solution from jQuery-File-Upload and make it work on every browser, with a special dedication to Internet Explorer. The basic version has the advantage of not being overloaded with libraries, and above all it is much easier to import into a site that already exists. Libraries <script type=”text/javascript” src=”//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js”></script><script type=”text/javascript” … Read more

CSS – Making an attribute of one class more important than another

MacBook avec code sur un bureau

In order for one CSS attribute to take precedence over another, for example when an item is defined by two classes, it is possible to use the !important option. For example: <div class=”style1 style2″></div> CSS: .style1 { background-color: #38c8ff; } .style2 { background-color: #ffffff !important; } The background will ultimately be white.

Categories CSS