Jump to content

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"]
        $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) {
      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":[]}]"
      string(655) "HTTP/1.1 200 OK
    X-Frame-Options: SAMEORIGIN
    Content-Length: 449
    Content-Type: application/json
    Vary: Accept, Cookie
    Date: Tue, 28 Aug 2018 04:25:38 GMT
    Connection: close
      object(Requests_Response_Headers)#5 (1) {
        array(6) {
          array(1) {
            string(10) "SAMEORIGIN"
          array(1) {
            string(18) "GET, HEAD, OPTIONS"
          array(1) {
            string(3) "449"
          array(1) {
            string(16) "application/json"
          array(1) {
            string(14) "Accept, Cookie"
          array(1) {
            string(29) "Tue, 28 Aug 2018 04:25:38 GMT"
      string(42) "http://xxxx:8000/api/groups/list/"
      array(0) {
      object(Requests_Cookie_Jar)#2 (1) {
        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