Jump to content
malin

The $request result do not shows in the database when developing WHMCS

Recommended Posts

I added a ClientAdd hook in developing WHMCS:

    add_hook('ClientAdd', 1, function($vars){

        logActivity('client add -liaomalin2');
        // phonenumber, username
        $params = array(
            "whmcs_tblclients_id" => $vars['userid'],
            "email" => $vars['email'],
            "username" => $vars['email'],
            "phone" => $vars['phonenumber'],
            "password" => $vars["password"]
        );
    
        // QICLOUD_API_USER_REGISTER
        $request = Requests::get('http://xxx.xxx.xxx.xxx:8000/api/groups/list/', array(), null); //
    
        logActivity($params . '$params-liaomalin2');
    
        logActivity($request . '$request-liaomalin2');
    
    });

but in the database, log activity:

[![enter image description here][1]][1]

you see the `$request` is nothing there, the `$params` is a Array. where is the error? 

I tried the code in my other demo project:

    $request = Requests::get('http://xxx.xxx.xxx.xxx:8000/api/groups/list/', array(), null); 

the `$request` is a object:

    object(Requests_Response)#4 (10) {
      ["body"]=>
      string(449) "[{"id":2,"name":"group02","permissions":[34,35,36,31,32,33,1,2,22,23,24]},{"id":1,"name":"staff","permissions":[1,2,3]},{"id":7,"name":"aa","permissions":[]},{"id":5,"name":"a","permissions":[34,35,36]},{"id":3,"name":"a","permissions":[13]},{"id":6,"name":"test1","permissions":[]},{"id":4,"name":"s","permissions":[]},{"id":8,"name":"","permissions":[]},{"id":9,"name":"x","permissions":[]}]"
      ["raw"]=>
      string(655) "HTTP/1.1 200 OK
    X-Frame-Options: SAMEORIGIN
    Allow: GET, HEAD, OPTIONS
    Content-Length: 449
    Content-Type: application/json
    Vary: Accept, Cookie
    Date: Tue, 28 Aug 2018 04:25:38 GMT
    Connection: close
    
    [{"id":2,"name":"group02","permissions":[34,35,36,31,32,33,1,2,22,23,24]},{"id":1,"name":"staff","permissions":[1,2,3]},{"id":7,"name":"s","permissions":[]},{"id":5,"name":"s","permissions":[34,35,36]},{"id":3,"name":"s","permissions":[13]},{"id":6,"name":"test1","permissions":[]},{"id":4,"name":"a","permissions":[]},{"id":8,"name":"a","permissions":[]},{"id":9,"name":"a","permissions":[]}]"
      ["headers"]=>
      object(Requests_Response_Headers)#5 (1) {
        ["data":protected]=>
        array(6) {
          ["x-frame-options"]=>
          array(1) {
            [0]=>
            string(10) "SAMEORIGIN"
          }
          ["allow"]=>
          array(1) {
            [0]=>
            string(18) "GET, HEAD, OPTIONS"
          }
          ["content-length"]=>
          array(1) {
            [0]=>
            string(3) "449"
          }
          ["content-type"]=>
          array(1) {
            [0]=>
            string(16) "application/json"
          }
          ["vary"]=>
          array(1) {
            [0]=>
            string(14) "Accept, Cookie"
          }
          ["date"]=>
          array(1) {
            [0]=>
            string(29) "Tue, 28 Aug 2018 04:25:38 GMT"
          }
        }
      }
      ["status_code"]=>
      int(200)
      ["protocol_version"]=>
      float(1.1)
      ["success"]=>
      bool(true)
      ["redirects"]=>
      int(0)
      ["url"]=>
      string(42) "http://xxxx:8000/api/groups/list/"
      ["history"]=>
      array(0) {
      }
      ["cookies"]=>
      object(Requests_Cookie_Jar)#2 (1) {
        ["cookies":protected]=>
        array(0) {
        }
      }
    }

  [1]: https://i.stack.imgur.com/8yUac.jpg


Why the logActivity is nothing?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated