Category: 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, […]

  • Create Blank Page for WordPress Blog Using Your Theme Template

    There may come a time when you need to create a blank page on your WordPress site that still uses your template’s header, footer and sidebar.  For example, if you incorporate your own custom search from google, you will need to specify a landing page where the search results will be displayed. You could use […]

  • 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 = […]