This is my first time messing with SOAP. $params = array( 'user' => 'username@gmail.com', 'password' => 'password', 'keyStr' => $keyStr, 'subId' => $subId); $return_string = $client->call('getKey','getTodaySubIDStats','getYesterdaySubIDStats','getMonthToDateSubIDStats','getLastMonthSubIDStats', $params); PHP: The $return_string = $client->call('getKey','getTodaySubIDStats','getYesterdaySubIDStats','getMonthToDateSubIDStats','getLastMonthSubIDStats', $params); spits out Fatal error: Uncaught SoapFault exception: [Client] Function ("call") is not a valid method for this service in /home/site82/public_html/stats.php:20 Stack trace: #0 /home/site82/public_html/stats.php(20): SoapClient->__call('call', Array) #1 /home/site82/public_html/stats.php(20): SoapClient->call('getKey', 'getTodaySubIDSt...', 'getYesterdaySub...', 'getMonthToDateS...', 'getLastMonthSub...', Array) #2 {main} thrown in /home/site82/public_html/stats.php on line 20 So I E-Mailed support and got this so I tried... $return_string = $client->getTodaySubIDStats(user,password,keyStr,subId); and it then spits out Fatal error: Uncaught SoapFault exception: [HTTP] Internal Server Error in /home/site82/public_html/stats.php:17 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://www.maxb...', '', 1, 0) #1 /home/site82/public_html/stats.php(17): SoapClient->__call('getTodaySubIDSt...', Array) #2 /home/site82/public_html/stats.php(17): SoapClient->getTodaySubIDStats('user', 'password', 'keyStr', 'subId') #3 {main} thrown in /home/site82/public_html/stats.php on line 17 How do I call it the correct way?? WSDL is at http://www.maxbounty.com/api/api.cfc?wsdl
I tested the Hello World example and it worked. $client = new SoapClient("http://www.maxbounty.com/api/api.cfc?wsdl"); echo $client->helloWorld(); PHP: This should output "Hello World" Is this working for you? If yes, then we can proceed to next function, otherwise you have configuration problem. (I'm using PHP 5.2 and built in Soap Client).
Ok, that's good This is probably your problem. You are calling the getTodaySubIDDetails with wrong params. The correct signature is this: getTodaySubIDDetails(string $keyStr, string $subId) Following code *should* be working: (You need to use your real valid credentials and sub_id ofc) $user = "yourusername"; $pass = "yourpass"; $client = new SoapClient("http://www.maxbounty.com/api/api.cfc?wsdl"); $key = $client->getKey($user, $pass); $sub_id = "whatever"; $rslt = $client->getTodaySubIDStats($key, $sub_id); var_dump($rslt); PHP:
Thanks. Now it's getting the info!! Is it possible to combine the four rslt lines and four dumps in to one rslt line and one dump line, and also have the <HR> between each of them? Would I need to hunt for a PHP SOAP script to turn the results in to HTML, or just use the PHP str_replace or preg_replace stuff to make the HTML stats page? <?php require_once('nusoap/lib/nusoap.php'); $user = "username@gmail.com"; $pass = "password"; $sub_id = "ID"; $client = new SoapClient("http://www.maxbounty.com/api/api.cfc?wsdl"); $key = $client->getKey($user, $pass); $rslt = $client->getTodaySubIDStats($key, $sub_id); $rslt2 = $client->getYesterdaySubIDStats($key, $sub_id); $rslt3 = $client->getMonthToDateSubIDStats($key, $sub_id); $rslt4 = $client->getLastMonthSubIDStats($key, $sub_id); var_dump($rslt); echo "<HR>"; var_dump($rslt2); echo "<HR>"; var_dump($rslt3); echo "<HR>"; var_dump($rslt4); unset($client); ?>
Well, var_dump is there just to visualize result, it's is useful for debugging purposes. You shouldn't need/use it in production environment. I don't know the exact layout and structure of returning $rslt, but it should be pure array data, no need for preg_replace, you could define some kind of html template and then just loop through your result and output the content.