Download a QR

Download the code of the sendget function defined in the file sendhttp.php. Copy the file in the space of your application.

NOTE: See the page Call the service API for a description of the sendget function.

loginYour identification code.
passwordYour password.
signmiiThe signmii to encode in the QR.
fgForeground color of the QR.
bgBackground color of the QR.
qualityQuality level of the QR.
sizeSize of the QR.

signmii is the string of characters returned by the getsignmii action.

fg and bg have the standard format RRGGBB in hexadecimal with or without a # (HASHMARK).

quality defines the error percentage of the reproduction of the QR. The higher the correction rate is, the bigger is the minimum size of the QR:


size multiplies the minimum size of the QR by a value between 1 and 10. EXAMPLE: A QR for a signmi of quality M and of size 2 will be 154 pixels by 154 pixels.

IMPORTANT: QR code readers work better if the contrast between the color of the QR and its background is strong. Check with a smartphone.

Add the file getqr.php with the following content:

  1. require_once 'sendhttp.php';

Loads the code of the sendget function provided by iZend.

  1. function getqr($login, $password, $signmii, $fg='#000000', $bg='#ffffff', $quality='M', $size='1') {

Defines the function getqr. $login is your identification code. $password is your password. $signmii contains the text of the signmii which will be encoded in the QR. $fg gives the color of the QR, black by default. $bg gives the background color of the QR, white by default. $quality gives the quality level of the QR, M by default. $size gives the size of the QR, 1 by default.

  1.     $curl = 'http://signmii.com/api/getqr';
  2.     $args = array(
  3.         'login'     => $login,
  4.         'password'  => $password,
  5.         'signmii'   => $signmii,
  6.         'fg'        => $fg,
  7.         'bg'        => $bg,
  8.         'quality'   => $quality,
  9.         'size'      => $size,
  10.     );

Sets $curl to the URL of the getqr action. Fills the array $args with the parameters of the getqr action. NOTE: Replace http by https in the URL to encrypt the communication.

  1.     $response=sendget($curl, $args);

Sends the HTTP request with sendget.

  1.     if (!$response or $response[0] != 200) {
  2.         return false;
  3.     }

If $response is false, the server is unreachable. If $response[0] doesn't contain the HTTP return code 200 Ok, an execution error has occurred. In case of error, getqr returns false.

  1.     $r = $response[1]['Content-Disposition'];
  2.     $filename=substr($r, strpos($r, 'filename=')+9);

Extracts the file name from the header of the response.

  1.     $data=$response[2];
  3.     file_put_contents($filename, $data);

Writes the body of the response, the binary representation of the PNG image of the QR code, in the current folder.

  1.     return $filename;
  2. }

Returns the file name.


Assuming you have saved the files sendhttp.php and getqr.php in the current directory, run PHP in interactive mode, load the getqr function and call it with your identification code, your password and text of a signmii in argument:

$ php -a
php > $signmii='uIWPRlfPaB8VgkTHIg8IoTe72WtTLgL_vGoWjY8PfM9fFjwXb8LmvMsMGKVUUTvJOy-z536BC-GMCOaDDdHhcWqGEYyUlXULwwGBXQL7drGnnbTa0H4bCD1YME6H9q7xIdMqlD9pIS-CIAsAo1SYguOhHP9bBlZ_7vk91gmKmxJQi6ril_UlvUmvmjJbUSnoyvDBLPcOWTa0hPDiPKnLifaimHHzkKfLtD9Ck2DAam9G3q3ME0zayVOTTlFdyPsOwvM6SvOMqAi-iBV40Bg5Ky4wKJztDMiCCBCdx3k-jvMfVtZM61MoIDNaICeI59UYE-HL8cPX3CcRphXYdFmRHg';
php > require_once 'getqr.php';
php > echo getqr('abcdef', 'ABCDEF', $signmii);

The image of the QR is in the file signmii.png.

Try a color and a larger size:

php > getqr('abcdef', 'ABCDEF', $signmii, '#aa0000', '#000000', 'L', 8);
php > quit

Get a signmii and Check a signmii


Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]commande[/code], [code=langage]code source en c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].