Category: "PHP"

Passing Structured Data from Perl to PHP
Jun 14th
After writing many lines of Perl to decode data returned from database queries which must then be passed back to PHP, I found JSON conversion routines which are much faster and more reliable. In addition, unlike my awkward Perl, they work!
:::::::::… more »

Google OAuth and Contacts API - PHP Curl Examples
Apr 26th
This code uses Zend Framework's Zend_Json::decode method, however you can use json_decode if it is available on your version of PHP.
Create the authorization link
When this link is clicked, the site visitor is presented with a page from Google askin… more »

PHP <-> Perl Bridge using cURL
Jul 18th
Using cURL to submit requests from PHP into Perl allows graceful reuse of code with a system with a robust core of Perl code and a PHP web interface.
The Perl code accepts a module name, sub/function name, and a set of parameters.
It includes the modu… more »

Google Maps API - Distance Calculator - PHP Example
Jul 13th
This code gets the distance, in miles, between two US Zip codes (04429 and 02135). You can substitute other origins and destinations.
<?php
function curl_request($sURL,$sQueryString=null)
{
$cURL=curl_init();
curl_setopt($cU… more »

PHP Text Highlighter
Jul 13th
This snippet accepts an array of words, and a descriptive name which can be used to reference the words, like so:
$this->scan(array('mysql','css','js','content management system',
'xhtml','xml','rss','html','lamp','ria',
'sugar','php','zen… more »