Tag: php

  • Address Standardization & Verification with USPS web tools and PHP

    Before using this code you will need to sign up for an account with USPS webtools here. Class, save as ‘usps_address_class.php’

  • php: Create Url Safe Encrypted String

    The following code represents an easy way to create an encrypted string that can be passed in an URL.  While this method is adequate for email addresses, user names, and the like – it should not be used to encrypt mission-critical info or personal data such as Social Security numbers or credit card information. Also, […]

  • php: Send xml/soap to Secured Server

    Sample requires curl see code below: function callWebServicePost($host, $url, $payload, $user, $password) { $header[] = “Host: “. $host; $header[] = “Content-type: text/xml”; $header[] = “Content-length: “.strlen($payload) . “\r\n”; $header[] = $payload; $session = curl_init($url); // Tell curl to use HTTP POST curl_setopt ($session, CURLOPT_POST, true); curl_setopt($session, CURLOPT_CONNECTTIMEOUT,30); // Tell curl that this is the body […]

  • Display images in a directory with php

    Here’s a quick and dirty way to show all the files in a directory. I use this in my images folder to see what’s there. Some improvements would be to add a mime-type check or a *jpg check. <?php $path = “./”; $dir_handle = @opendir($path) or die(“Unable to open folder”); while (false !== ($file = […]