1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

catch the Nusoap error with php

Discussion in 'PHP & Perl' started by barigain, Dec 10, 2013.

  1. barigain

    barigain Junior Member

    Joined:
    Aug 23, 2012
    Messages:
    100
    Likes Received:
    12
    The method i tried using was with openssl

    PHP:
    $fp fopen($key'r');  //open the PEM file
    $priv_key fread($fp,8192);
    fclose($fp);
    $pkeyid openssl_get_privatekey($priv_key,"password");

    openssl_sign($response["data_to_sign"], $signature$pkeyid,'sha256');

    $sign base64_encode($signature)

    Is this the correct Method to generate signature for signed urls in google?
     
  2. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,062
    Likes Received:
    2,872
    Gender:
    Male
    Not sure what you are trying to achieve but did you try using try catch blocks?

    E.g.:

    PHP:
    try{
    $fp fopen($key'r');  //open the PEM file
    $priv_key fread($fp,8192);
    fclose($fp);
    $pkeyid openssl_get_privatekey($priv_key,"password");

    openssl_sign($response["data_to_sign"], $signature$pkeyid,'sha256');

    $sign base64_encode($signature);
    } catch (
    Exception $e){
    echo 
    $e->getMessage();
    }


     
  3. barigain

    barigain Junior Member

    Joined:
    Aug 23, 2012
    Messages:
    100
    Likes Received:
    12
    Thank you for advice, but seems I generate invalid signature. There is nothing to catch..