I built some code that runs and connects to various cPanel servers - all at different ISP's to pull down email info for a spam protection system.
Here is a snippet of code:
I have quite a bit of error handling to deal with the problems I see. Connection errors, unable to resolve host, access denied etc. They are all caught with these different handling routines.
You can see WOW PROBLEM, I end up here sometimes and $jResult is nothing. I have nothing returned from the server, no error of any type - $jResult is blank. How can I get something to determine what is going on?
I suspect I end up here under at least a couple situations based on manual testing.
1) If I connect to port 2082 and the system redirects me to port 2083, I end up in the WOW PROBLEM section.
2) The server has a self signed SSL cert, I think I also end up in the WOW PROBLEM section of code. Not sure of these two cases, because I don't know where to look for any error information.
Any ideas?
Here is a snippet of code:
PHP:
try {
if ( $jResult = $cPanel->api2_query($userAccount, "Email", "listpops", $domain ) ) {
if ( $objResult = json_decode($jResult) ) {
// Says the result was success, lets check the JSON and see if it really was a success.
} else {
// Some error, searching in $jResult which is probably an HTML result like 401 access denied
}
} else {
// WOW PROBLEM. If we end up here $jResult is totally empty, how do we get debug info
}
} catch ( Exception $e) {
// Handle exceptions, things like unable to resolve host, connection failures etc. end up here
}
You can see WOW PROBLEM, I end up here sometimes and $jResult is nothing. I have nothing returned from the server, no error of any type - $jResult is blank. How can I get something to determine what is going on?
I suspect I end up here under at least a couple situations based on manual testing.
1) If I connect to port 2082 and the system redirects me to port 2083, I end up in the WOW PROBLEM section.
2) The server has a self signed SSL cert, I think I also end up in the WOW PROBLEM section of code. Not sure of these two cases, because I don't know where to look for any error information.
Any ideas?