Best Kali Linux Compatible Wireless Adapters/Dongles 2017

On 8/20/2017 Be the first to comment!

Here are the best kali linux compatible wireless adapters and usb dongles for 2017. Kali Linux is a Linux distribution mainly used for Penetration Testing, accessing N/W Security & Ethical Hacking. The process of choosing a wireless adapter or usb dongle to work with Kali Linux is not an easy task. It's just because the Operating system doesn't support all kinds of wifi adapters.

For example Pentesting requires a card to go into monitor mode and do packet injection which all cards can't do it. The Card's chipset and drivers is what determines if an adapter is compatible with kali or not.

Below I have listed out the most popular chipsets for Kali linux and Wireless adapters compatible with them. They work well for Penetration testing too.

Popular Kali Linux Compatible Chipsets:

  • Atheros AR9271
  • Ralink RT3070
  • Ralink RT3572

Best Kali Linux Compatible Wireless Adapters:

1. Alfa AWUS036NHA (Atheros AR9271 Chipset Compatible)

Check Price

Alfa-AWUS036NHA

Alfa AWUS036NHA is a best wifi adapter for pentesting. For penetration testing, Atheros AR9271 is a good chipset and you can go for Alfa AWUS036NHA card if you plan to run Kali as VM. Just get the job done without hassle.

  • Compatible with any 802.11b, 802.11g or 802.11n routers using 2.4Ghz band
  • Supports multiple input multiple output
  • High speed transfer TX data rate of up to 150 mbps
  • Includes 4" detachable antenna of 5 dbi which can be upgraded up to 9 dbi.
  • Works with 64/128-bit wep, wpa, wpa2, tkip, aes security protocols.
  • Supports Windows 2000, XP 32/64, vista 32/64 & Windows 7 Platform. So compatible with Kali Linux running as VM on these hosts.

Get It Now From Amazon »

2. TP-Link TL-WN722N (AR9271 Chipset Compatible)

Check Price

best wifi card for kali linux

Another great USB Wireless Adapter for cheapest price. TP-Link TL-WN722N uses AR9271 Chipset and has great range of up to 150Mbps. The card is easy to set up and works perfectly with Kali Linux.

  • Supports Wireless speed of up to 150Mbps
  • Works both on Infrastructure and Ad-Hoc Mode
  • Includes a detachable 4dbi omni directional antenna
  • Supports WPS & USB 2.0
  • Compatible with Windows XP, Windows Vista, Windows 7, 8, 8.1 platforms

Get It Now From Amazon »

3. Alfa AWUSO36NH (RT3070 Chipset Compatible)

Check Price

best alfa wifi adapter for kali

One of the best wireless dongle for pentesting. This 2 Watt 802.11n compatible Wi-fi dongle is quite powerful and supports Ralink RT3070 Chipset. It has very good range and perfect for packet monitoring.

  • Compatible with any 2.4GHz routers of 802.11n, 802.11b/g/n wireless standards
  • Includes removable 4" - 5 dBi antenna and can be be upgraded up to 9dBi
  • Supports 64/128-bit WEP, WPA, WPA2, TKIP, AES Protocols
  • Compatible with Windows 2000, XP 32/64, Vista 32/64, Windows 7, Linux (2.4.x/2.6.x),and Mac (10.4.x/10.5.x)

Get It Now From Amazon »

4. Alfa AWUS036NEH (RT3070 Chipset)

Check Price

Alfa-AWUS036NEH

This Wi-Fi Dongle is similar to Alfa AWUSO36NH in specs and covers long range. Alfa AWUS036NEH is exceptional for penetration testing and is good at packet injection and monitoring.

  • Works well with any 802.11b/g and 'N' routers
  • Includes removable 4" 5dBi antenna (upgradable up to 9dBi)
  • Supports packet injection & monitor mode
  • Protocols supported - 64/128-bit WEP, WPA, WPA2, TKIP, AES
  • Compatible with Windows 2000, 32/64 bit XP, Vista, Windows 7, Linux (2.4.x/2.6.x), Mac (10.4.x/10.5.x) Power PC& PC.

Get It Now From Amazon »

5. Panda PAU05 (RT3070 Chipset)

Check Price

Panda-PAU05

Panda 300mbps wireless n usb adapter is very reasonably priced and works with 802.11g/n standard and offers a data speed of up to 300 Mbps. It is exceptionally good considering the price but make sure to download and install the latest driver (alone) for Windows 7 and leave the rest of the setup to Windows itself.

  • Compatible with any 802.11g or 802.11n 2.4Ghz wireless routers
  • Wireless speed of up to 300Mbps
  • Works with both infrastructure and ad-hoc modes
  • Security protocol compliant: 64/128bit WEP, WPA, WPA2, 802.1x and 802.11i, Cisco CCS V1.0, 2.0 and 3.0
  • Supports 32/64-bit Windows 8/7/Vista, Mac OS 10.4/10.5/10.6/10.7/10.8/10.9 and latest version of 32/64-bit Mint, Ubuntu, Fedora, openSUSE, etc.

Get It Now From Amazon »

6. Alfa AWUS051NH (Ralink RT3572 Chipset)

Check Price

Alfa-AWUS051NH

Alfa AWUS051NH is little expensive but has amazing signal reception and works well on Kali Linux and in 5Ghz Monitor mode.

  • It is compatible with 802.11n draft 3.0, 802.11a/b/g wireless standards
  • Work with 2.4GHz and 5.8GHz band and MIMO (Multiple Input Multiple Output)
  • Supports wireless transfer RX data rate of up to to 300 Mbps
  • Allows wireless data encryption with 64/128-bit WEP, WPA, WPA2, TKIP, AES Protocols
  • Compatible with Windows 2000, 32/64 bit XP & Vista, Linux (2.4.x/2.6.x), Mac (10.4.x/10.5.x) Power PC& PC.

Get It Now From Amazon »

What Makes a Wireless Adapter Compatible with Kali?

Kali is a popular Linux Distro commonly used by security and penetrating testing professionals. Not all wireless adapters are made to work with Kali Linux. Only the drivers and chipsets decides if they are compatibile with the OS or not.

In addition, if you run it as a VM, the USB adapter must also be compatible with the host operating system.

Any of the above recommended devices will be good for pentesting, but you are called to decide which one is right for your configuration.

Long-range adapters with big dBi antenna are great for distance but not exactly compact. On the other hand smaller ones with built-in antenna are good for staying low profile.

Over To You:

So these are the best wireless adapters and usb dongles for kali linux. Though all these adapters works well with Kali, just make sure if it is the right one for your environment. For example if you wish to run Kali on Virtual box in Windows 7 host then make sure the card is compatible with Windows 7 OS. Also you must be cautious about the coverage range. Antenna with bigger dBi would be better for longer range. This helps you avoid future trouble. If you find this useful please share it with others to give them good suggestion.

Also Read:

Create Fullscreen HTML5 Video Background with CSS

On 8/15/2017 Be the first to comment!

Hi! Today I'm going to share a code snippet to create fullscreen html5 video background on websites. Full screen background has become a popular trend of web design and nothing grabs user attention than a good video background. It will make website visitors to stop and take notice thus increasing the time spent on a website. It is a great marketing tactic to get business leads as well. Here we will see how to add full screen background video using HTML5 and CSS. You don't need any plug-ins which is a huge plus of this method.

HTML5 Video:

HTML5 supports so many media objects and Video is one among them. The compatibility of HTML5 Video is very high and most modern browsers support it.

HTML5 has this <video> element to add videos to a webpage with several configuration attributes like 'autoplay', 'loop' etc. It acts as a placeholder for a video object and supports the 'poster' attribute which will be replaced by the first frame of the video on loading. Therefore it is a good practice to set the poster image as the first frame of a video.

Read: Quick PHP Form Validation using Parsley.js

Create Placeholder for HTML5 Video:

First create a html5 placeholder for the video and add the video source to it.

HTML Markup:

<video id="bgvideo" poster="images/malachite-kingfisher.jpg" playsinline autoplay loop muted>
    <source src="malachite-kingfisher.webm" type="video/webm">
    <source src="malachite-kingfisher.mp4" type="video/mp4">
</video>

Note that without the 'loop' attribute, the video will play only once.

Next add some css to set the video to full screen, center on page and place it behind all the html elements of the web page. Also add a fallback image to the background and this could be the first frame of the video.

CSS:

#bgvideo {
    background: url('images/malachite-kingfisher.jpg') no-repeat;
    position: fixed;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    transform: translateX(-50%) translateY(-50%);
    -moz-transform: translateX(-50%) translateY(-50%);
    -webkit-transform: translateX(-50%) translateY(-50%);
    -ms-transform: translateX(-50%) translateY(-50%);
    transition: 1s opacity;
    background-size: cover;
    z-index: -100;
}

Read: Detect and Redirect to Mobile Site using PHP and JavaScript

Add Text to the Webpage:

Now let's add some text in the foreground. This could be an excellent place to promote products or services.

HTML Markup:

<div id="bgtext"> 
    <h1>Malachite Kingfisher</h1>
    <p>One among the rarest birds in the World!!!</p>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.</p>
    <p>Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac.</p>
    <p><a href="#">More Details Here »</a></p>
</div>

Simply adding the text won't do. We have to layer the text in front and position it in such a way that it does not hide the background video, but enough to catch user's attention. We can use css to do it.

CSS:

#bgtext {
 color: white;
 width: 33%;
 background: rgba(0,0,0,0.3);
 font-family: Arial Narrow, sans-serif;
 font-weight: 100;
 padding: 28px;
 margin: 28px;
 font-size: 19px;
 float: right;
 text-align: justify;
}

h1 {
 margin-top: 0;
 font-size: 42px;
 text-transform: uppercase;
 letter-spacing: 4px;
}

a {
 background:rgba(0,0,0,0.5);
 color: #FFFFFF;
 text-decoration: none;
 padding: 7px;
 transition: .6s background;
 display: inline-block;
}

a:hover {
 background: rgba(0,0,0,0.9);
}

#bgtext button {
 width: 80%;
 background: rgba(255,255,255,0.23);
 color: #FFFFFF;
 margin: 14px auto;
 font-size: 18px;
 padding: 6px;
 display: block;
 border: none;
 border-radius: 3px;
 cursor: pointer;
 transition: .3s background;
}

#bgtext button:hover {
 background: rgba(0,0,0,0.5);
}

That's it! We now have a nice full background video layered with text on the front.

fullscreen-html5-video-background-css

The following is the complete script of our example.

index.html

<!DOCTYPE html>
<html>
<head>
    <title>Fullscreen HTML5 Video Background</title>
    <link href="css/mystyles.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <video id="bgvideo" poster="images/malachite-kingfisher.jpg" playsinline autoplay loop muted>
        <source src="malachite-kingfisher.webm" type="video/webm">
        <source src="malachite-kingfisher.mp4" type="video/mp4">
    </video>
    <div id="bgtext">
        <h1>Malachite Kingfisher</h1>
        <p>One among the rarest birds in the World!!!</p>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.</p>
        <p>Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac.</p>
        <p><a href="#">More Details Here »</a></p>
    </div>
</body>
</html>

mystyles.css

body {
    margin: 0;
    background: #000000;
}

#bgvideo {
    background: url('images/malachite-kingfisher.jpg') no-repeat;
    position: fixed;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    transform: translateX(-50%) translateY(-50%);
    transition: 1s opacity;
    background-size: cover;
    z-index: -100;
}

#bgtext {
    color: white;
    width: 33%;
    background: rgba(0,0,0,0.3);
    font-family: Arial Narrow, sans-serif;
    font-weight: 100;
    padding: 28px;
    margin: 28px;
    font-size: 19px;
    float: right;
    text-align: justify;
}

#bgtext button {
    width: 80%;
    background: rgba(255,255,255,0.23);
    color: #FFFFFF;
    margin: 14px auto;
    font-size: 18px;
    padding: 6px;
    display: block;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: .3s background;
}

#bgtext button:hover {
    background: rgba(0,0,0,0.5);
}

a {
    background:rgba(0,0,0,0.5);
    color: #FFFFFF;
    text-decoration: none;
    padding: 7px;
    transition: .6s background;
    display: inline-block;
}

a:hover {
    background: rgba(0,0,0,0.9);
}

h1 {
    margin-top: 0;
    font-size: 42px;
    text-transform: uppercase;
    letter-spacing: 4px;
}

Read: Currency Conversion in PHP using Google Finance API

With native HTML5 Video and little CSS code we can implement full screen video background on your website. Background video is a powerful feature, but it must be handled effectively. Too long or too short video wouldn't cut it. Also make sure to compress video and keep its size no more than 5 MB so that it takes less bandwidth. I hope you like this tutorial. Please don't forget to share it in social media.

How to Detect and Redirect to Mobile Site using PHP and JavaScript

On 8/02/2017 Be the first to comment!

Hey! In this post, let's see how to detect mobile device and redirect to a mobile site using php (server-side) and javascript (client-side). Since Mobile usage has been exploded these days, every website should be mobile-friendly. Either your site must be responsive or have a separate mobile version.

A mobile website is just the light-weight version of a website specifically designed to view on smaller screens like smartphones and tablets. Usually mobile sites are hosted on sub domains like m.mydomain.com. Popular sites like Gmail, Facebook etc have separate mobile versions and if they are opened on mobile devices, will be redirected respectively.

detect mobile visitors and redirect to mobile site php

How to Detect Mobile Device and Redirect to Mobile Website?

If you have a mobile site, you should redirect mobile visitors to your mobile website. But how do you know if the user accesses the site from a mobile or desktop browser? Well! You can know it through 'user-agent' string. The user-agent string contains information about the browser name, version, operating system etc. We can use these details to determine if the user access site from the mobile or desktop.

Read: Store and Retrieve Image from Database using PHP & MySQL

You can also check for other things like screen size and tell if it is a mobile device or not. You can do this on the client side by using plain old java script. Here is a small snippet to redirect mobile visitors to the mobile site using javascript.

Mobile Site Redirection on Client Side:

Place this script on the landing page of your site and when the visitor access it from the mobile phone, the js code will check the width of the screen and redirect it to the appropriate site.

<script type="text/javascript">
if (screen.width <= 768) {
    window.location = "http://m.yourdomain.com";
}
</script>

The downside of this method is it requires java script. But not all mobile browsers support it or user could disable javascript on the browser. So doing the checking process on the server side with script like php is a much better approach.

Let's see how to do it in php.

Read: How to Lazy Load Images in PHP and JavaScript

Detect and Redirect Mobile Visitors in PHP:

On the server side, you have to use the user agent string to detect the mobile environment and redirect users. Here's the php code to do it.

<?php
$usr_agent=$_SERVER["HTTP_USER_AGENT"];
if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$usr_agent) || preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr($usr_agent,0,4))){
    header("Location: http://m.yourdomain.com/");
}
?>

Just place this code at the top of the index/landing page of your website and it will detect and redirect mobile visitors to the appropriate mobile site.

Using Mobile Detect Library:

If you don't want to deal with the long list of user agents by yourself you can use the 'Mobile Detect' library. It is a light-weight php class for detecting mobile devices. It uses a combination of user agent string and http headers to detect the mobile environment.

First download mobile detect class and extract it to the website's root folder. Next you must include the 'Mobile_Detect.php' file in your index file and use the isMobile() function to detect mobile device.

<?php
include_once 'Mobile_Detect.php';
$device = new Mobile_Detect;
 
// check if it is a mobile
if($device->isMobile()){
    header("Location: http://m.yourdomain.com/");
}
?>

The code above checks if the visitor is from a mobile device and redirects to the mobile version of the website.

There is also a separate use case for detecting tablets specifically.

<?php
// check if it is a tablet
if($device->isTablet()){
    // code
}
?>

You can also detect the specific platform like Android or iOS like this.

<?php
include_once 'Mobile_Detect.php';
$mobileos = new Mobile_Detect;

// Check for specific platform
if($mobileos->isiOS()){
    // code
} else if($mobileos->isAndroidOS()){
    // code
} else if($mobileos->isWindowsPhoneOS()){
    // code
}
?>

Keep in mind that mobile detection is a growing platform, as new devices are coming to market every other day. So, make sure you constantly update the script to make it compatible with the latest devices.

Read: Currency Conversion using PHP and Google Finance API

That was all about detecting and redirecting visitors to mobile site using php. The user-agent method relies heavily on HTTP headers to extract device information. Sometimes the results can go wrong as it is easy for someone to tamper the headers. But so far it is better than the rest other methods available. I hope you like this tutorial. Please don't forget to share this post in social platforms.

Currency Conversion in PHP using Google Finance API

On 7/18/2017 Be the first to comment!

Hi! In this tutorial, let us see how to convert currency in PHP using Google Finance API. There are lots of currency conversion api's available but I'm going to use Google Finance here. Using the api you can easily convert money to your desired country currency. You have to send out http request to Google finance tagging with three values - amount, from currency and to currency code. And it sends back the response as HTML which you have to parse and extract the converted amount.

google api currency conversion php

Read: Store and Retrieve Image from Database in PHP & MySQL

PHP Function to Convert Currency:

Following is the currency convertor function I have created. The function takes up 3 params namely 'from_currency', 'to_currency' and 'amt' and makes call to google finance api. It uses file_get_contents() function to send http request and receives raw html response. Then it parses the html and returns the converted currency value.

<?php
function convert_currency($from_currency, $to_currency, $amt) {
    $from_currency = urlencode($from_currency);
    $to_currency = urlencode($to_currency);
    $amt = urlencode($amt);
    $data = file_get_contents("http://www.google.com/finance/converter?a=$amt&from=$from_currency&to=$to_currency");
    $data = explode('bld>', $data);
    $data = explode($to_currency, $data[1]);
    return round($data[0], 2);
}
?>

Function Usage:

echo convert_currency(USD, EUR, 100);

How to Convert Currency in PHP?

Now let me show you how to use the above function and implement currency convertor functionality in your application with a demo.

For that we'll need to create two php files, index.php and function.php.

In function.php, we keep the convert_currency() function we have created earlier. And in the index file, add a html form and input fields for amount and two dropdowns to choose from and to currency.

Read: Easy PHP Form Validation with Parsley.js Library

index.php

<?php
include_once "function.php";

//check if form is submitted
if (isset($_POST["submit"])) {
    $from_curr = $_POST["from_currency"];
    $to_curr = $_POST["to_currency"];
    $amount = $_POST["amount"];
    $result = convert_currency($from_curr, $to_curr, $amount);
}
?>
<!DOCTYPE html>
<html>
<head>
    <title>Currency Conversion in PHP</title>
</head>
<body>
    <h1>Currency Convertor</h1>
    <form action="index.php" method="post">
        <label for="amount">Amount</label> 
        <input type="text" name="amount" placeholder="Enter amount" value="<?php if(isset($_POST["amount"])){echo $_POST["amount"];} ?>" required />

        <?php
        $options = array(
            'GBP' => 'British Pound £',
            'EUR' => 'Euro €',
            'FRF' => 'French Franc (FRF)',
            'DEM' => 'German Mark (DEM)',
            'INR' => 'Indian Rupee (INR)',
            'USD' => 'US Dollar (USD)'
        );
        ?>
        <select name="from_currency">
        <?php foreach($options as $key => $value){ ?>
            <option value="<?php echo $key; ?>" <?php if(isset($_POST["from_currency"]) && ($_POST["from_currency"]==$key)){echo "selected";} ?>><?php echo $value; ?></option>
        <? } ?>
        </select>
        <br/><br/>
        <label>To</label> 
        <select name="to_currency">
        <?php foreach($options as $key => $value){ ?>
            <option value="<?php echo $key; ?>" <?php if(isset($_POST["to_currency"]) && ($_POST["to_currency"]==$key)){echo "selected";} ?>><?php echo $value; ?></option>
        <? } ?>
        </select>
        <input type="submit" name="submit" value="Convert" />
    </form>

    <span><h2><?php if (isset($result)) { echo $amount . " " . $from_curr . " = " . $result . " " . $to_curr; } ?></h2></span>
</body>
</html>

function.php

<?php
function convert_currency($from_currency, $to_currency, $amt) {
    $from_currency = urlencode($from_currency);
    $to_currency = urlencode($to_currency);
    $amt = urlencode($amt);
    $data = file_get_contents("http://www.google.com/finance/converter?a=$amt&from=$from_currency&to=$to_currency");
    $data = explode('bld>', $data);
    $data = explode($to_currency, $data[1]);
    return round($data[0], 2);
}
?>

So user must enter the amount value, from and to currency code and submit the form. And the script sends http request to Google finance, get response, extract and display the converted amount on the page.

Read: How to Get YouTube Video Details from URL in PHP

Likewise you can implement currency convertor in php application. I hope you find this useful. If you like this tutorial, please don't forget to share it in social media. Meet you in another interesting post.

Get YouTube Video Title, Description & Thumbnail from URL in PHP

On 7/04/2017 Be the first to comment!

Hi! In this tutorial I'm going to show you how to get youtube video details like title, description, thumbnail image etc from a video url using php script. With the help of Google's YouTube Data API you can fetch information about youtube videos. In general each youtube video will have a specific 'ID' associated to it. To retrieve data about a video you have to pass this video id while making the api call. And the api in turn returns back the video data as json response.

YouTube API is not only helpful to fetch basic video info but also let you create playlists, channels, implement youtube search and much more.

Get YouTube Data API Key

YouTube Data API is free to use but first you must get access to it. You need a Google account to get api access and is provided in the form of an api key.

1. To get api-key, go to https://console.developers.google.com and login with your Google account.

2. Once you are in, create a new project and click on 'ENABLE API' link at the top.

3. Now scroll down to 'Youtube APIs' section and select 'Youtube Data API'.

get youtube data api key 1

4. Then click on the 'ENABLE' link at the top-right side of the page to enable youtube data api for your account.

get youtube data api key 2

5. Once enabled, select 'Credentials' on the left-pane. Under credentials click on 'Create credentials' button and choose 'API key' in the dropdown.

get youtube data api key 3

7. Your api key will be generated and shown in a popup. Save the key to a text file for later use.

get youtube data api key 4

Done! Now we have the key to access youtube api. Let's move on to the coding part.

Fetching YouTube Video Information

In general YouTube videos share a common url structure and they look like this.

https://www.youtube.com/watch?v=VIDEO_ID

Where 'VIDEO_ID' represents the individual video id.

You have to take this video id from the youtube video url and use it to fetch details.

Like I already said, to fetch video information you have to call the youtube api. And you must also send the corresponding 'VIDEO_ID' and 'parts' of the information you need to retrieve. Following is the php script to do it.

PHP Script to Get YouTube Video Details

<?php
$videoid = 'H4Jx4oefSjw'; // change this
$apikey = 'API_KEY'; // change this

$json = file_get_contents('https://www.googleapis.com/youtube/v3/videos?id=' . $videoid . '&key=' . $apikey . '&part=snippet');

$data = json_decode($json, true);

echo "<pre>";
print_r($data);
?>

The above snippet will produce an output like this.

Array
(
    [kind] => youtube#videoListResponse
    [etag] => "m2yskBQFythfE4irbTIeOgYYfBU/YJEU8MCit4Jt-7o2NPm81zgElAQ"
    [pageInfo] => Array
        (
            [totalResults] => 1
            [resultsPerPage] => 1
        )

    [items] => Array
        (
            [0] => Array
                (
                    [kind] => youtube#video
                    [etag] => "m2yskBQFythfE4irbTIeOgYYfBU/Sx66nqOT7ouBnClI9ImzyEA1n90"
                    [id] => H4Jx4oefSjw
                    [snippet] => Array
                        (
                            [publishedAt] => 2013-08-01T04:12:47.000Z
                            [channelId] => UCj4LfrxdH7TnUZlyHOKgL5A
                            [title] => 01. Programming in Objective-C - Introduction
                            [description] => Ever wondered what Objective-C actually is? Historically, it was the first attempt to make C objectified. C++ came later. NextStep, and now OSX, popularized this very powerful language. So sit back, as Yari D`Areglia takes you through the first steps in getting started with this language.
                            [thumbnails] => Array
                                (
                                    [default] => Array
                                        (
                                            [url] => https://i.ytimg.com/vi/H4Jx4oefSjw/default.jpg
                                            [width] => 120
                                            [height] => 90
                                        )

                                    [medium] => Array
                                        (
                                            [url] => https://i.ytimg.com/vi/H4Jx4oefSjw/mqdefault.jpg
                                            [width] => 320
                                            [height] => 180
                                        )

                                    [high] => Array
                                        (
                                            [url] => https://i.ytimg.com/vi/H4Jx4oefSjw/hqdefault.jpg
                                            [width] => 480
                                            [height] => 360
                                        )

                                    [standard] => Array
                                        (
                                            [url] => https://i.ytimg.com/vi/H4Jx4oefSjw/sddefault.jpg
                                            [width] => 640
                                            [height] => 480
                                        )

                                    [maxres] => Array
                                        (
                                            [url] => https://i.ytimg.com/vi/H4Jx4oefSjw/maxresdefault.jpg
                                            [width] => 1280
                                            [height] => 720
                                        )

                                )

                            [channelTitle] => Dilan Damith Prasanga I.G.
                            [tags] => Array
                                (
                                    [0] => Objective-C (Programming Language)
                                    [1] => Programming In Objective-C
                                    [2] => Programming Language (Literary Genre)
                                )

                            [categoryId] => 27
                            [liveBroadcastContent] => none
                            [localized] => Array
                                (
                                    [title] => 01. Programming in Objective-C - Introduction
                                    [description] => Ever wondered what Objective-C actually is? Historically, it was the first attempt to make C objectified. C++ came later. NextStep, and now OSX, popularized this very powerful language. So sit back, as Yari D`Areglia takes you through the first steps in getting started with this language.
                                )

                        )

                )

        )

)

As you can see, we have decoded the json response to php array and it contains details like video title, description, thumbnail urls, view count, channel id and much more. Now you must parse this array to extract individual data like title, description etc.

To Get YouTube Video Title,

<?php echo $data['items'][0]['snippet']['title']; ?>

To Get YouTube Video Description,

<?php echo $data['items'][0]['snippet']['description']; ?>

To Get YouTube Video Thumbnail URL,

<?php $data['items'][0]['snippet']['thumbnails']['default']['url']; ?>

YouTube stores four different types of thumbnails at various resolutions for a single video. Above, I have taken the default thumbnail image url.

Once you've got the video info, use it as per your liking. Here is a simple example in which I have displayed video details in a web page.

Example

<?php
echo '<h1>Title: ' . $data['items'][0]['snippet']['title'] . '</h1>';
echo '<img src="' . $data['items'][0]['snippet']['thumbnails']['default']['url'] . '" style="float:right;"/>';
echo '<p>' . $data['items'][0]['snippet']['description'] . '</p>';
?>
fetch youtube video title description and thumbnail in php

I hope now you have clear understanding of using youtube data api to fetch youtube video details using php. This is just a taste of what youtube api can do. Obviously there's more to it. I'll cover the api more in detail in future posts. If you like this tutorial, don't forget to share it in social media.

Best USB Wireless Network Adapters/Dongles - Buying Guide & Reviews

On 6/29/2017 Be the first to comment!

Slow Internet connection sucks! Even when you have reliable ISP, good modem, router and everything, a bad network adapter will spoil the party. No one wants to compromise the Internet speed and connectivity in the middle of work or gaming. A good quality wireless adapter will drastically improve the NET performance and give you peace of mind. Moreover, if Wi-Fi network is shared among household members, then a Best USB Wireless Adapter/Dongle goes a long way providing fast and secure internet connection.

best usb wireless adapters 2017 reviews

If you are looking to buy a USB Wireless Adapter then make sure the adapter easily talks to the router and works best for desktop PC, laptop and tablet. Knowing a few things about Wi-Fi will help you pick the right wireless adapter for your needs.

What Is A USB Wireless Adapter & How Does It Work?

A USB wireless adapter is a small device that quickly sets up wireless connectivity to your desktop or laptop via the router. It is plugged into the USB port of the computer and adds up Wi-Fi ability to non Wi-Fi computer.

The Wireless Adapters are also called as Wi-Fi dongles and come in all shape and size. Also they vary in the types of protocol they use for transferring wireless signals.

These days Desktops and Laptops come with built-in Wi-Fi cards but it's not the case with older computers. On the other hand, you might want to upgrade your laptop's wifi or fix a broken wireless card. In either case, a good external USB wireless adapter will make your computer wifi ready.

Top 10 USB Wireless Adapters in 2017 Reviews

1. NETGEAR AC1200 WiFi USB Adapter (A6210)

Netgear AC1200 USB WiFi Adapter is a high-end dongle with excellent wifi performance. The adapter works on dual band supporting 2.4GHz and 5Ghz wireless setup.

It works with USB 3.0 and delivers high data rates with the latest 802.11ac protocol. And the high-gain antennas give good distance coverage. No bigger than a flash drive the adapter is compact-looking and snugly fits into the computer's USB without blocking adjacent ports. It comes with NETGEAR genie for easy installation and supports all Windows OS versions. There is also a desktop dock for flexible placement of the adapter.

  • 802.11ac High Gain USB 3.0 Dual Band adapter
  • Works with 802.11a/b/g/n and ac devices
  • USB 3.0 interface and compatible with USB 2.0
  • High-gain antennas + Desktop Dock
  • Beam forming+ technology
  • Compatible with Windows Operating System

Check Price on Amazon


2. ASUS USB-AC68 Dual-Band AC1900 with Included Cradle

If you are looking for a high-speed wireless adapter then ASUS USB-AC68 dual-band dongle is your best option. It uses the newest technology chipset Realtek RTL8814AU and the fastest wifi dongle in the market.

It comes with two foldable external antennas to cover large distance and it does. There is also an USB cradle which you can extend when required.

The dual band dongle has max speed of up to 1900 Mbps which is split among 2.4 GHz and 5 GHz range. 600Mbps transfer rate at 2.4GHz and 1300Mbps at 5GHz frequency.

This USB Wifi adapter has impressive speed and wireless connectivity. But note that this is not a budget device. If you have specific need for fastest wifi then go for ASUS USB-AC68 without second thought. There's no support Linux OS so if you look for one to use in Linux go for other recommendations in this list.

  • 802.11ac Dual band USB Adapter
  • Robust 3x4 MIMO Antenna design
  • Dual 3-position foldable external antennas
  • Up to 600 Mbps speed on 2.4GHz band, 1300 Mbps on 5GHz band
  • ASUS AiRadar beamforming
  • Includes USB 3.0 cradle

Check Price on Amazon


3. TP-LINK AC600 (Archer T2UH)

TP-Link Archer T2UH USB Wireless Adapter is an entry-level 802.11ac adapter suitable for regular day-to-day use. The adapter works on dual band so it will pick up signals on both 2.4GHz and 5GHz frequency.

The dongle's speed and wireless connectivity is good for personal use. It comes with external antenna which you can twist and tweak to gain better wifi signals. Also there is a 3-foot usb cable that let you place the adapter near the router for maximum throughput.

TP-Link Archer T2UH USB Adapter utilizes USB 2.0 and has speed cap at 480Mbps which is the only downside to it. Even then this rate is not at all less for home.

It supports Windows and Mac machines and overall a decent adapter from a reputable brand.

  • High-gain external antenna for long distance
  • WiFi speed up to 600Mbps with simultaneous 5GHz and 2.4GHz bands
  • WPS button for secured encryption
  • Includes 3 Feet USB cable for adapter placement
  • Compatible with Windows 8.1, 8, 7, XP, Linux, Mac OS X 10.7-10.10

Check Price on Amazon


4. Alfa Long-Range Dual Band AC1200 Wireless Adapter

The Alfa AC1200 is a dual band long-range adapter with support for the latest 802.11ac protocol. It has very good antennas for long distance coverage and there is no problem working on the 5GHz frequency.

This dongle is not exactly portable, but it has good wifi connectivity and speed even at distance. It's a USB 3.0 adapter and achieves excellent data transfer rates at 5GHz range. Unless you do not have USB 3.0 port on your computer there will be no bottleneck in speed.

So if you need a USB adapter that works long distance and supports the new 5GHz band, Alfa AC1200 is the best option.

  • Supports 802.11ac / 802.11N / 802.11a/b/g Wifi Standards
  • High-speed data: 300Mbps on Wireless-N, 867Mbps on Wireless-AC
  • Operates on Dual band (2.4GHz / 5GHz)
  • 2 Removable 5dBi rubber duck external antennas
  • Supports WEP 64-Bit, WEP 128-Bit, WPA-PSK & WPA2-PSK
  • Windows 10, 8.1, 8, 7, Vista, XP, Mac & Linux compatible

Check Price on Amazon


5. DEBBIECTY MSRM 912AC WiFi Adapter

DEBBIECTY MSRM 912AC WiFi Adapter is an 802.11AC Dual Band dongle that works on both 2.4GHz and 5GHz frequency range. It utilizes USB 3.0 and has data rates of up to 1200 Mbps.

What we like the most about MSRM 912AC adapter is it runs on Windows 10 OS Plug-and-Play like a charm. There's no driver problem with windows 10 and the setup is quick and easy.

It also supports earlier Windows versions like Windows 7, 8, 8.1, and Vista too. The dongle is cheap, windows 10 compatible and works on dual-band. Besides the built-in antenna is quite good and let it stay low-profile for laptop and desktop usage.

In general, MSRM 912AC adapter wifi adapter is a great fit for all networks and the protocol 802.11ac is backward compatible. In addition, although designed to work with USB 3.0, it is compatible with USB 2.0 and 1.0.

  • Wireless AC Dual band (2.4/5GHz) dongle
  • Slim design with powerful internal antennas
  • Quick and Easy plug-and-play setup
  • USB 3.0 support, backward compatible with USB 2.0/1.0
  • Supports Windows 10, 8.1, 8, 7 & Vista OS

6. Panda Wireless PAU06 300Mbps N USB Adapter

Panda's Wireless-N Network Adapter is a low-cost solution for upgrading your desktop / laptop wifi. It operates on the 2.4GHz network and has a maximum speed of up to 300Mbps.

It is an 802.11n dongle so speed is optimum but has wide range and works well from long distance. There is also a screw in antenna at the back of the device for good range.

The adapter is backward compatible with 802.11g 2.4GHz network and does not work on 5GHz band. It supports Windows (XP, Vista, 7, 8, 8.1 and 10), MAC and Linux OS.

  • Operates on 802.11n and 802.11g 2.4GHz wireless networks
  • WPS button wireless setup
  • Maximum speed up to 300 Mbps
  • Low power consumption in laptop/portable devices
  • 64b/128bit WEP, WPA and WPA2 (TKIP+AES)
  • Compatible with 32/64 bit Windows XP, Vista, 7, 8, 8.1, 10, Mac OS Mint, Ubuntu, openSUSE, etc.

Check Price on Amazon


7. NET-DYN Mini USB WiFi Adapter

NET-DYN USB WiFi Adapter is a fast, easy and inexpensive solution for adding wireless connectivity to your PC or fixing your laptop's broken Wi-Fi. The mini adapter comes with internal antennas and remains low profile connected to the computer's USB. And the good thing is that it does not block the nearby ports so you can connect it directly to the computer without the need for an extension cable.

It is a Wireless-N USB 2.0 adapter so the speed is good enough for personal use. The dongle operates in the 2.4GHz range and has maximum data rate of up to 300Mbps.

Overall it's a cheap and reliable USB Wifi adapter and works great on Windows 10 and Mac and earlier versions of Windows like Windows 8.1, 8, 7, Vista and XP.

  • 802.11n / b / g Wi-Fi adapter and works in 2.4 Frequency range
  • Compatible with Windows 10, 8.1, 8, 7, Vista, XP, 2000 and Mac 10.9 and 10.10
  • Compatible with all WLAN routers (WPA / WPA2 / WEP)
  • Built-in omni directional internal antenna
  • Supports USB 2.0 and old 1.1

Check Price on Amazon


8. Dodocool AC600 Dual Band WiFi Adapter

Dodocool is another very low cost dual band 802.11ac adapter. Since it is a dual-band dongle it fits on any network.

Although it supports the newest 802.11ac wifi protocol, it is backward compatible with older wireless networks such as Wireless-n/g networks.

The device is small in size and fits easily on to the laptops USB port without getting in your way. As for setup, it works well with Windows 10 plug-and-play - and also compatible with previous versions like Windows 8.1, 8, 7 etc.

Since Dodocool AC600 is a mini adapter it lacks big antennas that come with large wifi adapters. So that limits the adapter to short range.

Overall the USB wireless adapter is easy to setup wifi to your computer and get the job done on budget.

  • 802.11ac Compatible Dual Band AC 600 Adapter
  • Support for both 2.4GHz and 5GHz bands
  • Up to 433 Mbps speed at 5GHz & 150 Mbps at 2.4GHz
  • Plug and play easy wifi setup
  • Works with 802.11 ac/a/b/g/n routers
  • Compatible with Windows XP, Vista, 7, 8, 8.1, 10, Mac OS X

Check Price on Amazon


9. OURLiNK 1200Mbps USB 3.0 Mini 802.11ac Adapter

OURLiNK 802.11ac adapter from Glam Hobby is a very small and low-cost dongle that works on 2.4GHz and 5Gz wireless networks. It has a simple and easy configuration and connects your Windows 10 machine to wifi in a matter of seconds.
It is a USB 3.0 adapter and easily reaches 100Mbps speed which is great for such a small device. It also supports Mac OS and earlier Windows versions like XP, Vista, 7, 8 and 8.1.

The USB adapter's connection is impressive and covers a good range from 25 to 30 feet away. Overall, it is ideal for online gaming and no-buffer HD streaming.

  • 802.11ac 1200 Mbps Wireless Dual-band adapter
  • Speed up to 867Mbps on 5GHz + 300Mbps on 2.4GHz N/w
  • Superspeed USB 3.0 Port Interface
  • Innovative compact body design
  • Compatible with Windows 10, 8.1, 8, 7, XP and Mac OS

Check Price on Amazon


10. TP-Link Archer T1U Wireless Nano USB Adapter (AC450)

The TP-LINK Archer T1U is another good entry-level Wifi USB adapter and works with the 802.11ac standard.

The adapter is small and discreet so that you can connect it to the PC and leave it there. It only works on the newer 5 GHz range and there's no support for the old 2.4 GHz. So if distance is a problem, go for any of the dual-band adapters that are given in this list.

As for compatibility, Archer T1U works with most of the operating system, including windows 10. In addition the dongle uses USB 2.0 so speed would be optimal and good for home/personal use only.

  • Supports 802.11ac/a/n wireless standard
  • Works only on the new 5GHz band
  • Up to 433 Mbps data transfer rates
  • Encryption standards: WEP, WPA/WPA2, and WPA-PSK/WPA2-PSK
  • Compatible with Windows (XP, Vista, 7, 8, 8.1, 10), Linux & Mac OS X

Check Price on Amazon


USB Extension Cord

While some of the USB Wifi adapters are small and discreet, most of the powerful dongles will be slightly bigger and can block the adjacent ports of your computer. Plus you may also need to position the adapters in the direction of router for better signal. There is a simple fix for this problem. Using an USB extension cord will help you keep wireless adapters far away from the computer/laptop and in the direction of router. And the near by ports will not be blocked.


Best USB Wireless Adapters for Gaming

1. TP-Link AC1200 Wireless Dual Band USB Adapter (Archer T4U V1)

TP-Link is a reliable brand among wireless equipments. The Archer T4U V1 is an 802.11ac dual band adapter and supports any type of network.

The dongle offers ultrafast wireless speeds up to 1200 Mbps combining both 2.4GHz and 5GHz frequencies. It gives data rates of up to 867Mbps at 5GHz and 300Mbps at 2.4GHz bands.

The USB adapter works on USB 3.0 and supports SoftAP so you can use it as a Wi-Fi hotspot and share the Internet connection of your PC among other devices. If you live in a crowded city then it is recommended to use 5GHz to enjoy enhanced online gaming.

Another good thing is it comes with 1 meter USB extension cable so the nearby ports will not be blocked when connected to the computer or laptop.

  • Delivers ultra-fast 1200 Mbps speed With 802.11ac standard
  • Dual band adapter works on both 2.4 / 5 GHz bands
  • WPS Button for quick setup of wireless connection
  • 1 meter USB 3.0 Extension Cable
  • USB 3.0 support

Check Price on Amazon


2. Alfa AC1200 Long-Range Wi-Fi Adapter

Alfa USB Wifi adapter is one of the best long-range dongle in the market and supports the latest 802.11ac protocol. The adapter is backward compatible and works on older wireless protocols such as 802.11n/g/b/a.

It is not a small device but has excellent range. There are two 5dBi removable antennas for distance and has the data transfer speed of up to 867 Mbps on 5GHz frequency.

The adapter is dual-band and works on both 2.4GHz and 5GHz band. It supports all Operating systems such as Windows (10/8/7/Vista/XP), Mac & Linux.

If you need a high-speed wifi adapter that works from distance for online gaming then Alfa AC1200 is your best choice.

  • Dual-Band 2.4GHz/5GHz USB Wireless Adapter
  • Delivers speed up to 300Mbps on Wireless-N & 867 Mbps on Wireless-AC
  • Supports Wi-Fi Standards 802.11ac, 802.11n, 802.11a, 802.11b
  • Two 5 dBi removable antennas for good distance
  • Compatible with Windows XP, Vista, 7, 8, 8.1, Mac & Linux

Check Price on Amazon


3. Linksys WUSB6300 AC1200 Wireless Adapter

The Linksys WUSB6300 USB wireless adapter works on dual band and supports the latest standard Wireless AC. It is ideal for connecting PC or laptop to high-speed 802.11ac networks.

It is a Wireless-AC dongle but also backward compatible with the Wireless-N standard. It works on USB 3.0 for fast performance and offers 867 Mbps speed in 5GHz band and a speed of 300 Mbps in 2.4GHz band combining a total theoretical speed of 1200 Mbps. You can enjoy lag-free online gaming via 5GHz network.

For secured wifi it supports 128 bit WEP, WPA and WPA2 encryption. The adapter is compatible with Windows 10 OS and earlier versions like 8.1, 8, 7, Vista and XP.

  • Dual band 802.11ac Wireless AC adapter
  • Speed up to 867Mbps on Wireless-AC & 300 Mbps on Wireless-N
  • 128-bit encryption support (WEP, WPA and WPA2)
  • Compatible with all 802.11ac devices
  • Supports MS Windows 10, 8.1, 8, 7, Vista SP1/SP2 and XP SP3
  • USB 3.0 support

Check Price on Amazon


How to Choose the Best Wireless Network Adapter - Buying Guide

Tech savvy or not, knowing few things about Wi-fi and Adapters will help you choose the right adapter that works best in your network system. So let's see some of the important features you must consider before buying a USB Wireless Adapter.

1. What are Wireless Protocols?

802.11 is the number representing the Wireless protocols. It is the universal standard set for wireless products so that they can communicate with each other without trouble.

The current Wi-Fi standard is 802.11ac and introduced in 2013. It works only on 5 GHZ band but can transfer data much faster than wireless N.

But most devices in today's market use the previous 802.11n (or) Wireless-N protocol. This is the widely used wifi standard and works on both 2.4 GHz and 5 GHz band.

Dual Band: Adapters that works on both 2.4GHz and 5GHz frequency ranges are known as dual-band wireless adapters.

To simply put the newer 802.11ac wireless adapters have better speed over Wireless N device. So can you buy the 802.11ac dongle?

Well! It depends.

The fact is 802.11ac is fast but has less coverage. Remember it only works on 5 GHz range? The higher frequency does not travel as far as the lower 2.4 GHz frequency.

So if there is not much distance between adapter and router then the best option would be an 802.11ac dongle. Else go for the dual band Wireless-N dongle which is good for long distance range.

2. Wireless Frequencies

There is two type of frequencies used for wireless transmission. One is 2.4 GHz and the other one is 5 GHz range. Up until 2013, only 2.4 GHz band was used. But later due to overcrowding of wireless networks they have introduced the higher 5 GHz band.

The higher the frequency the less the signal can travel through barriers. So a 2.4GHz dongle will transmit data farther than the new 5GHz dongles.

Numerous networks still use 2.4GHz band and collide with other wireless devices fighting to get a signal through. And the fact that it travels a greater distance and penetrates through walls makes the situation even worse.

Hence the introduction of the 5GHz band. It travels less distance and has mighty speed. The network is also less crowded so there is a little chance for the collision with other N/w s.

3. Distance

Antennas play a larger role when it comes to distance. Some USB wireless adapters come with the built-in antenna which is good for staying low profile. But these internal antennas will not transmit signal as far as large external antennas.

On the other hand adapters with external antennas cover long distance well and carry wireless signal better than the built-in one. They come with a screw-in antenna which can be easily replaced with large dBi antenna as per distance requirement.

Generally, antenna size is measured in dBi. As a general rule of thumb, the larger the dBi the higher the coverage. But keep in mind having an adapter with large dBi antenna will not guarantee better signal at long distance - as external factors like barriers, adapter wattage will affect the signal quality.

4. Speed

Speed matters in a wireless connection... A LOT!

Till date, the Wireless-AC adapters (802.11ac) have the fastest data transfer speed of up to 1.3Gbps. The second best is the Wireless-N adapters (802.11n) with a speed of up to 300 Mbps which indeed is not at all slow for personal use.

But 802.11ac will only work in 5GHz range so if you prefer distance over speed then stick to the old 802.11n which works on 2.4GHz band.

Just keep in mind.

2.4 GHz band travel far but has less speed (relative).

5 GHz band travel less but with greater speed.

Certain dual band adapters are capable of using both 2.4GHz and 5GHz bands for maximum speed and said to have 1200Mbps transfer rate. Note that it's just a theoretical estimation and hard to be achieved in real-life. Wireless speed is always relative to the environment you live in.

5. Easy to Use

Wireless adapters are easy to setup and use it. With PCI adapters you have to go through installation process via setup CD and all. But that's not the case with USB Wifi adapters. Most of the USB Adapters are the plug-and-play type. All you have to do is to connect them to a free USB Port of your computer and the system will automatically detect the device and run set up for the first time. Once the driver is installed you are good to go from there.

6. Compatibility

The wireless adapter must be compatible with the router to send and receive data. Dual band routers will work with any adapter. But an old router will only work on 2.4 GHz range. So make sure the adapter also works in the similar range.

In case you are not sure about the router being used, just get a Dual Band Wireless N adapter. It will work with any router.

Besides your Desktop/Laptop Operating system is also important. A Wi-Fi adapter must be compatible with the computer OS in order to work. So make sure your adapter works on a particular OS and also have updated drivers required for it.

So if you buy a wireless adapter to work on Windows 10 machine, it must be compliant with Windows 10 OS. The fact it works on Windows 7 or 8 doesn't mean it will also work on Win 10 version.

7. USB 2.0 Vs USB 3.0

USB 3.0 is mandatory for 802.11ac adapters. This is because their peak data rate exceeds the USB 2.0 speed on 2.4GHz band.

USB 2.0 can transfer data at 480Mbps, the new USB 3.0 at 5Gbps speed. This is only theoretical, but real world's performance is always lower than this.


PCI Based or USB Wi-Fi Adapter? Which One to Choose?

Before starting your hunt for wireless adapters, you must first know that there are two types of wireless adapters commonly used these days. Let's see what they are.

USB Wireless Adapter

The first type of wireless adapter is USB based. USB Wifi adapters are the simplest to install and use among the two types. It's because of their plug and play nature. They work like a flash drive in this context.

You have to simply plug it into a USB Port, and then the computer will automatically detect, run setup and install the necessary drivers. After that, you can connect it to any available Wi-Fi network and you are good to go from there. The installation process takes place only for the first time you use it on a PC or Laptop.

Well! The wifi adapter is external and requires one free USB Port. In some cases, the devices are bigger and might as well block nearby ports. Plus you may need it to be out of the way of other computer cables.

In fact, it's good to use an USB extension cable to connect USB Wireless adapters. They will be out of your way and can be kept farther from PC to pick up wifi signals better.

PCI Based Wireless Adapter

PCI stands for Peripheral Component Interconnect and wireless adapters of these types should be plugged into the PCI slot of the computer's motherboard. These devices are bigger than the USB network adapters and come with powerful antennas sticking out at the back of the adapters.

PCI wifi adapters generally crowd over the area they are attached to. Plus somewhat harder to setup and use for an average user. Nonetheless, they are excellent in terms of wireless transmission and long distance coverage.

But overall I would happily choose anytime a USB wireless adapter over PCI ones just because of their simplicity and ease of use.


Advantages of Using USB Wireless Adapters

A USB wireless adapter is the easiest solution to put a device online. It's cheap, effective and has several advantages over using wired connection.

  • Free of Cords - The first and foremost benefit of using the wireless adapter is it eliminates the necessity of computer cables. Your computer desk will no more be a clutter of cords. You get to have true mobility if you work with laptop or tablet. When you have wifi, you don't have sit at your work table. You are free to take your work to couch or bed. Plus USB wireless adapters stay low profile and most of them look no bigger than a flash drive.
  • No Hardware Installation - There are several ways to set up wifi on your computer. Of all the choices USB wireless adapters is the popular choice for most users. It's because they are simple external devices. You have to simply plug them into a USB port, install drivers and connect to wifi network. That's all to the total set up. And the plug-and-play feature is even better.
  • But PCI based adapters have complicated setup. In some cases, you have to open up the computer or laptop case and fix wifi card to motherboard slot. Not a favorable choice at all.
  • Easy Replacement - Does your desktop doesn't have a built-in wifi card? Or you laptop wifi is broken? Then don't worry. You don't have to upgrade your entire computer which is quite costly. Get a USB wireless adapter compatible with your system OS. That'll do. It is the simplest solution to enable wifi on a computer. USB wifi adapters are very cheap and you can replace it at any time if the need arises.
  • Multi-Device Support - One of the key benefit of usb wireless adapter is it can be shared among multiple devices. Since it's an external device mounting and un-mounting is quite easy. So you can use the very same usb adapter on your laptop, desktop, tablet etc. The device is small so you can carry it anywhere you go and use it at your convenience.

FAQ on USB Wireless Adapters

I'm not sure about the Network used? Which Wi-Fi Adapter is right for me?

It's easier to get confused with all those wireless protocol numbers, operational frequency etc. If your network operates on 2.4GHz frequency then there's no point in buying a wireless adapter that only works on 5GHz band.

So in case you are not sure about the wireless network being used, then get a dual-band usb wifi dongle. They will work on most of the networks since they operate on both 2.4GHz and 5GHz band.

How can I know if an USB Wireless Adapter works on my Computer?

A wireless adapter needs to have driver software for the Operating system being used. So if you have Windows 10 PC, the wireless adapter you get to work with the machine must be Windows 10 compliant.

I live in City? Which Adapter should I buy?

802.11ac protocol only works in the new 5GHz band and doesn't travel far. So the network will be confined to a small area.

On the other hand, the older Wireless N works on 2.4GHz band and is widely used by many and travel far than 5GHz range. So there is a greater possibility for network collision in a crowded city which pulls down the wifi speed.

If you live in a city with crowded neighborhood your best choice would be a 5GHz Wifi adapter. If you live outside of the city limit with few neighbors then go for 2.4 GHz adapter which gives you greater coverage.

Can I use USB Wireless Adapter as Wi-Fi Hotspot?

Using USB wireless adapters as Wi-Fi Hotspot let you share the PC's internet connection with multiple devices like smartphone, tablet etc.

If your computer runs Windows 10 here's a way to do it.

Open Windows Settings > Network & Internet and choose 'Mobile HotSpot' and complete the setup wizard. You might as well need to tweak security settings to grant permission for this.


Over to You

USB Wireless Adapters are inexpensive and convenient solution to connect computers to wifi networks. But then the market is crowded with so many brands claiming their adapters are the best among all. And it's also a tough task to narrow down to an adapter that works best for you. Just remember, the Wi-Fi USB adapter must be compatible with your network and has drivers for the OS you use. The new 5GHz adapter will have high-speed but has short range. If you are not sure about the network and all, get a dual-band adapter. It will work with any network old or new.

Recommended Read For You: Best Kali Linux Wi-Fi Adapters

Store and Retrieve Image from Database using PHP MySQL

On 6/19/2017 Be the first to comment!

Hi! In this tutorial let's see how to store and retrieve image from mysql database using php. Have you ever tried to store images in a database? If not then we'll fix it now. Once upon a time it's been a developer's dream to save images in database just like any other numbers and texts. But thanks to the evolvement of relational databases, saving and fetching images to and from database is made possible these days. And the process is also less complicated than storing uploaded images to some folder on server.

Storing Image in MySQL Database

So, the question is how can you store images in mysql database? Well, using BLOB data type. BLOB stands for binary large data object and used to store large amount of binary data. Using this you can not only store pictures but also audio and other multimedia files in database.

Basically there are four types of BLOB available in mysql. They are:

  • TINYBLOB
  • BLOB
  • MEDIUMBLOB
  • LONGBLOB

All of these data types are similar except for the size of data they can hold.

Come let me show you how to store and display image from database using this BLOB type.

Read Also:

First let's create a database and a simple table for storing images.

MySQL Database Creation

CREATE DATABASE IF NOT EXISTS `db_demo`;
USE `db_demo`;
CREATE TABLE IF NOT EXISTS `tbl_gallery` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `imagedata` blob NOT NULL,
  `created` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

How to Insert Image into MySQL Database using PHP?

So the process goes like this. User uploads image via an uploading form which is then submitted to server. Then the image is converted into binary and inserted into mysql database along with its details such as name and time of creation.

index.php

This file contains the upload form for user to upload images to database.

<!DOCTYPE html>
<html>
<head>
    <title>Insert Image into MySQL Database using PHP</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" >
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
</head>
<body>
<br/>
<div class="container">
    <div class="col-xs-8 col-xs-offset-2 well" style="background:none;">
    <form action="upload.php" method="post" enctype="multipart/form-data">
        <legend>Please Choose Image to Upload</legend>
        <div class="form-group">
            <input type="file" name="glryimage" accept="image/*" />
        </div>
        <div class="form-group">
            <input type="submit" name="submit" value="Upload Image" class="btn btn-danger"/>
        </div>
        <?php if(isset($_GET['st'])) { ?>
            <div class="alert alert-danger text-center">
            <?php if ($_GET['st'] == 'success') {
                    echo "Image uploaded successfully!!!";
                }
                else
                {
                    echo 'Error uploading image...';
                } ?>
            </div>
        <?php } ?>
    </form>
    </div>
</div>
</body>
</html>

dbconnect.php

This php file contains the script for database connectivity. Here we establish the connection to mysql database via php code. Please make sure to change the connection settings as per yours.

<?php
//connect mysql database
$hostname = "localhost";
$username = "root";
$password = "";
$database = "db_demo";
$con = mysqli_connect($hostname, $username, $password, $database) or die("Error " . mysqli_error($con));
?>

upload.php

This is the actual uploading script. Here we receive the uploaded file, check if it is a valid image, convert image into binary data and insert image data and details into the database with php code.

<?php
include_once 'dbconnect.php';

//check if form submitted
if (isset($_POST['submit']))
{
    $img_name = $_FILES['glryimage']['name'];

    //upload file
    if ($img_name!='')
    {
        $ext = pathinfo($img_name, PATHINFO_EXTENSION);
        $allowed = ['png', 'gif', 'jpg', 'jpeg'];
    
        //check if it is valid image type
        if (in_array($ext, $allowed))
        {
            $created = @date('Y-m-d H:i:s');

            // read image data into a variable for inserting
            $img_data = addslashes(file_get_contents($_FILES['glryimage']['tmp_name']));
                    
            // insert image into mysql database
            $sql = "INSERT INTO tbl_gallery(name, imagedata, created) VALUES('$img_name', '$img_data', '$created')";
            mysqli_query($con, $sql) or die("Error " . mysqli_error($con));
            header("Location: index.php?st=success");
        }
        else
        {
            header("Location: index.php?st=error");
        }
    }
    else
        header("Location: index.php");
}
?>

Well! We have successfully stored image into database. But how to fetch this image from database and show it a page? We'll see it next.

Retrieve and Display Image from MySQL Database

You can retrieve image from mysql like you do with any other data. For example this script will fetch a specific image from the database and display it in a web page.

Displayimage.php

<?php
include_once 'dbconnect.php';
// fetch image from database
$sql = 'select * from tbl_gallery where id=1'; // change this id as per your need
$result = mysqli_query($con, $sql) or die('Error ' . mysqli_error($con));
$row = mysqli_fetch_array($result);
?>
<html>
<head>
    <title>Retrieve Image from MySQL Database in PHP</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" >
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
</head>
<body>
    <div class="container text-center">
        <?php echo '<img src="data:image/jpeg;base64,'.base64_encode($row['imagedata']).'"/>'; ?>
    </div>
</body>
</html>

In order to display image stored in a DB to a web page you have to use image tag rather than printing it directly. Please note that we have stored image as binary data. So you must do proper encoding before displaying the picture, else it won't work.

Done! We have everything in place. Now run 'index.php' file and you will be shown an upload form like this,

upload image to mysql database using php

Now select an image and click 'Upload Image' button. If things go right the image will be inserted into database without trouble and you will be notified like this.

insert image into database php mysql

To display the stored image from database run the script 'Displayimage.php'. It will show the image you have uploaded previously.

display image from mysql database using php

Please note that so many things can go wrong in the middle. So always remember to do proper error handling in your code.

Read Also:

I'm sure now you have better understanding of uploading and displaying images from database using php and mysql. The entire process is uncomplicated and effective than storing images in some server folder. It also saves you from processing through files to retrieve the images. I hope you like this tutorial. Please don't forget to share it in social media. Meet you in another interesting post :)

Contact Form

Name

Email *

Message *