LAMP How To – Open Source At Work

Only Passion Matters

Entries for July, 2010

sending data via url securely

Depending on your situation, sometimes it is quicker to append form data to urls. To do this securely, we need to encrypt it and decrypt it later. One good solution is to use mcrypt.
We can create a class like so:
class Encryption {

 var $skey  = “your own key”; 

    public  function safe_b64encode($string) {

        $data = base64_encode($string);
        $data = [...]

php curl proxy settings

It can be daunting to get proxy to work in curl. If it is not working for you, try changing the auth to ntlm.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘http://yoururl.com’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_PROXY , “your_proxy_ip:proxy_port”);
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch,CURLOPT_PROXYUSERPWD,”user:pass”);
curl_exec ($ch);
if(curl_errno($ch))
{
echo ‘Curl error: ‘ . curl_error($ch);
exit;
}
curl_close ($ch);