function generateHashLink($service_domain, $file_path, $url_signing_key ,$expiry_timestamp = NULL){

    // + and /  are some of represented chars of based64 encoding (8 bits)
    // + is 62 and / is 63 and these char should be replaced by other predefined chars
    $search_chars = array('+','/');
    $replace_chars = array('-', '_');

    if($file_path[0] != '/'){
        $file_path = "/{$file_path}";

    if($pos =  strpos($file_path, '?')){
        $file_path = substr($file_path, 0, $pos);

    $hash_string = $file_path.$url_signing_key;

        $hash_string = $expiry_timestamp.$hash_string;
        $expiry_timestamp = ",{$expiry_timestamp}";

    return  "http://{$service_domain}{$file_path}?secure=".
            str_replace($search_chars, $replace_chars, base64_encode(md5($hash_string, TRUE))).

Hai ... No.
this is not developers for hire.
when you registered on this forum, you've agreed to certain rules. I suggest you read those (again, if need be).

Try to check out regex (with Pattern and Matcher), File, String classes, etc. The documentation is quite straightforward.


Here you go:

    $TooLazyToDoItMySelf = true;

        echo "Show some effort then we will be happy to help";
commented: LOL! Good one! :-) +12

@iConqueror was there any reason to digg out this thread when all what you did is post just silly remark....