Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Friday, March 25, 2011

Generating QR codes

To generate a QR code on your page simply insert the following:

<img src="http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl=xxxURLxxx" width="100" height="100" />

Replace xxxURLxxx with the link you want. You can also change the size, but 100 by 100 is usually large enough to accommodate most URLs.

If you want to dynamically generate the QR code, you can replace xxxURLxxx with PHP like so:

<img src="http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl=<?php echo $varURL; ?>" width="100" height="100" />

Friday, March 4, 2011

Manage Your Code Deployment: Subversion To Web Server In One Click

Here's the simplest way to push a folder out of your repository onto your web server for testing.

<?php
$result = array();
$command  = 'svn export ';
$command .= 'https://your_server/svn/project /path/to/www ';
$command .= '--username USER --password PASS --force ';
$command .= '--non-interactive --trust-server-cert';
exec($command, $result);
print_r($result);
?>

- Host name HAS to match certificate (where I have "your_server")
- check .htaccess files, mod rewrite, ensure permissions are 755 and www-data is owner
- Version # can be forced with -r switch (svn -r 5 export ...)