Below you will find pages that utilize the taxonomy term “Programming”
Posts
Fetching data from a CSV file using PHP
To open a CSV file, start by opening the file by using PHP function fopen.
<pre class="lang:php decode:true ">$filePointer = fopen(CSV_FILE_PATH, "r"); // Modes: 'r' for read-only, 'w' for write-only, 'a' for append After opening the file (creating file pointer), cycle through the content using fgetcsv function. This function reads the file line by line and parse it based on fields in CSV.
<pre class="lang:php decode:true ">while (($list = fgetcsv($filePointer)) !
Posts
Ignoring SSl certificate when debugging in Android WebView
During development process if you are accessing a web page with SSL certificate you could either get a “Blank Page” or “Page Not Found” error.
To prevent this from happening while developing your app, simply override “onReceivedSslError” of WebViewClient object and continue the execution process.
By doing this, the SSL is being completely ignored and therefore could have a serious result if you forgot to remove the code after development and push the code into production.
Posts
Validating an email address with PHP
Steps to validate an email address:
Sanitizing the email address: strtolower($emailAddress); filter_var($emailAddress, FILTER_SANITIZE_EMAIL); // remove bad characters from the email. Validating the email adress: filter_var($emailAddress, FILTER_VALIDATE_EMAIL); Note: For email addresses containing Internationalized Domain Names (IDN) you need to convert it to punycode before validating the email address.
<pre class="lang:php decode:true ">function validateEmail($emailAddress) { $emailAddress = strtolower($emailAddress); $sanitilzedEmail = filter_var($emailAddress, FILTER_SANITIZE_EMAIL); if ($emailAddress == $sanitilzedEmail && filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) { return $emailAddress; } else { return false; } }