Skip to main content

UAPI Session

Comments

9 comments

  • cPanelMichael
    Hello @Sebastian Ng, Here's a quote from our UAPI Functions - Session::create_temp_user - Software Development Kit - cPanel Documentation Thank you.
    0
  • Sebastian Ng
    "; //echo $query; $curl = curl_init(); // Create Curl Object curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); // Allow self-signed certs curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); // Allow certs that do not match the hostname curl_setopt($curl, CURLOPT_HEADER,0); // Do not include header in output curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); // Return contents of transfer on curl_exec $header[0] = "Authorization: Basic " . base64_encode($user.":".$password) . "\n\r"; curl_setopt($curl, CURLOPT_HTTPHEADER, $header); // set the username and password curl_setopt($curl, CURLOPT_URL, $query); // execute the query $result = curl_exec($curl); $resultjson = json_decode( $result ); echo $resultjson->data->session_temp_user; echo $resultjson->data->created; echo $result; if ($result == false) { error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $query"); // log error if curl exec fails } curl_close($curl); ?> result {"data":{"created":0},"errors":null,"messages":null,"metadata":{},"status":1}
    0
  • cPanelMichael
    Hello, Could you provide more details about what you are attempting to do with the custom script? For instance, are you developing a cPanel plugin that requires access to phpMyAdmin? Or, are you attempting to simply generate a cPanel login session? If it's simply to generate the cPanel login session, you can follow the guide at: Guide to API Authentication - Single Sign On - Software Development Kit - cPanel Documentation Thank you.
    0
  • Sebastian Ng
    Dear Michael, Can you tell me more about the difference between this 2 functions? I would like to experience more in future i know which to use. Thank you. Best regards, Sebastian Ng
    0
  • Sebastian Ng
    Dear @cPanelMichael I am planing to call my own function from /frontend/paper_lantern/mail/own.html I try single sign on it doesn't work. Regards, Sebastian Ng
    0
  • cPanelMichael
    I am planing to call my own function from /frontend/paper_lantern/mail/own.html

    This is considered a cPanel plugin. We document the best approach to developing a cPanel plugin at: Guide to cPanel Plugins - Software Development Kit - cPanel Documentation Could you review this document (and the additional documents linked on it) and let us know if this helps clarify what's required? Thank you.
    0
  • Sebastian Ng
    Dear @cPanelMichael , How to set this thread as solve? Regards, Sebastian Ng
    0
  • cPanelMichael
    How to set this thread as solve?

    Could you confirm if the document referenced in my last response was able to help answer your questions? Thank you.
    0
  • Sebastian Ng
    @cPanelMichael, Yes the reference document did able to help me Sebastian
    0

Please sign in to leave a comment.