WHMCS new module - 404

Started by lexz, March 05, 2018, 04:25:23 PM

Previous topic - Next topic

lexz

Hey CWP forum,

I just installed WHMCS including the cwp module. Followed the video tutorial.
https://www.youtube.com/watch?v=96dizYdi6WY&

Account creation is not working and I get 404 not found when I try the api manual.

Anybody who can give me a hint or a solution?
Thank you very much!

josemnunez


lexz

Hey josemnunez

Thank you for your response.
I got the following error in WHMCS: Function not found

In the module log from WHMCS: the api response is empty.

But I think the problems seems to be the CWP api. You know a way to test it?
When I try to do a manual post to the CWP api I receive a 404 error.

Hope to hear from you soon.
Lexz

josemnunez

Be sure to create an api key and autotize the ip involved

can do a php and test the api, replacing the values of the variables

$ data = array ("key" => "MYKEY", "action" => 'list');
$ url = "https: // IPSERVERAPI: 2304 / v1 / account";
$ ch = curl_init ();
curl_setopt ($ ch, CURLOPT_URL, $ url);
curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ ch, CURLOPT_POSTFIELDS, http_build_query ($ data));
curl_setopt ($ ch, CURLOPT_POST, 1);
$ response = curl_exec ($ ch);
curl_close ($ ch);

lexz

I created a api key with the right permissions.

Also tried the php example you sended (found it under the API module in CWP)
But the result is empty.

Tried it on two different cwp servers. One of them is a CWP pro.
Other ideas?

josemnunez

What does this script say?


sh /script/check_api



lexz

This is the output:

User API port 2302 check: OK
Oauth query check: OK
External API port 2304 check: OK
External API files and htaccess : OK
CSF Firewall status check: ENABLED
TCP_IN for port 2304 set in /etc/csf/csf.conf: OK
TCP_OUT for port 2304 set in /etc/csf/csf.conf: OK



lexz

Today I tested the example php code from another server and it worked.
The server I used for testing this time, is a simple LAMP server (no CWP)

So I think the problem is not the API from CWP but something in the webserver configuration.
Both servers I've tested yesterday run CWP.

I will let you know if I found the problem.


lexz

Found the problem!

The problem was in a firewall. The servers could not reach each other's API.

Thanks for the support!

LIDHosting

So what did you do to the firewall

lexz

Nothing special. I had to open the ports on both sides.
Aswell on the requesting side as the server side. My requestging server wasn't allowed to use the API port for OUT traffic.

I thought it was port: 2304 (but it's good to check it, I'm not sure anymore)

Hope this will help you  :)

Purelaise

@lexz, When i do a curl of the https://myip:2304/v1/packages for instance i get:

<html><head><title>404 Page Not Found</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}s
trong{display:inline-block;width:65px;}</style></head><body><h1>404 Page Not Found</h1><p>The page you are looking for could not be found. Check the address bar to ensure your URL is spelled cor
rectly. If all else fails, you can visit our home page at the link below.</p><a href="/v1/">Visit the Home Page</a></body></html>You have new mail in /var/spool/mail/root

If i follow the link i get the same page.

josemnunez

Please confirm that hostname has some valid ssl

josemnunez

Hi

Can you show me what are you doing?

adamjedgar

#14
I was of the understanding that the port you set for cwp is what whmcs uses when provisioning.

So when configuring the cwp module and products in whmcs you assign domain.com:port and ipaddress:port

So whatever port your cwp uses is the same one you enter into whmcs.

(Perhaps i am confusing this with Virtualmin module) I will check mine tomorrow and post back if you haven't got a solution by then.