Home>

If the code below is executed, the message can not be flyed to ChatWork.
I added var_dump to the option setting, but I did not know the cause because it is all true.

May I get advice about the

cause?

//*** Chatbot creation: [Send MSG to ChatWork's own board when member is registered in Mikan DB]
    header ("content-type: text /html; charset= utf-8"); //To prevent garbage when displaying a response browser
    $ HEADER= ARRAY ('Content-Type: Application /X-www-Form-Urlencoded', 'X-ChatWorktoken: My API token');
    $ URL= "https://www.chatwork.com/v2/roms/lam (_ID }/Messages"; //Your room Room_ID
    $ CH= CURL_INIT ($ URL);
    $ BODY= ARRAY
      'Body'= >
 'Collaboration completion of API',
      'self_unread'= >
 '0'
    ;
    $ BODY_DATA= $ DATA= HTTP_BUILD_QUERY ($ BODY, "", "&
");
    //[TODO] HTTP request header information setting
    curl_setopt ($ ch, curropt_post, true);
    curl_setopt ($ CH, CURLOPT_POSTFIELDS, $ BODY_DATA);
    curl_setopt ($ CH, CURLOPT_HTTPHEADER, $ HEADER);
    curl_setopt ($ ch, curropt_returntransfer, true); //To a string to display the status code during error
    $ RESPONSE= CURL_EXEC ($ CH);
    $ STATUSCODE= CURL_GETINFO ($ CH, CURLINFO_RESPONSE_CODE);
    $ result= json_decode ($ RESPONSE);
    if (curl_errno ($ CH)) {
      ECHO 'CURL ERROR'.CURL_ERROR ($ CH);
      $ ERR_MSG []= 'ChatWORK Linked failed'; //This variable is defined in other places with the code you are listing.
    }
    curl_close ($ CH);
    //***** Chatbot creation so far *****
  • Answer # 1
    The URL to the

    Chat Work API was incorrect!

    https://www.chatwork.com/v2/roms/{room_id} /Messages
    
    

    Remove the cool {} of the above URL's URL

    https://www.chatwork.com/v2/roms/room_id/messages
    
    If you fix the description and the description, the request passed!