Showing posts with label QR Code. Show all posts
Showing posts with label QR Code. Show all posts

Friday, June 28, 2013

Create QR code generator using php-curl


    $url = "https://chart.googleapis.com/chart?";
    $strPost = "cht=qr&chs=177x177&chl=http://opendummies.blogspot.in/";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    // curl_setopt($ch, CURLOPT_PROXY, $proxy);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_HTTPGET,1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: image/jpeg"));
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $strPost); // add POST fields
    curl_setopt($ch, CURLOPT_POST, 1);
    header('Content-Type: image/jpeg');
    echo $result = curl_exec($ch);
    curl_close($ch);
    

output: