Help a developer debug a PHP class for using the PhishTank API
posted by John Roberts on November 10th, 2006 in PhishTank, API, Developers, PHP
David Branco is working on a PHP class, which he calls PhishTank Runner. The goal of PhishTank Runner is to make working with the PhishTank API very easy in that language. We haven’t had time to take a look at the code ourselves, but we shouldn’t be the bottleneck. If you’re a PHP developer, or otherwise experienced, David is eager for feedback. His email address is in the code.
The PHP source code is here:
http://www.neoeliteusa.com/demo/phishtank.class.phps
We’re not “endorsing” this code, but I’m pleased that David is interested in helping out, and I think constructive criticism helps us all in this regard. This is a new step for us, but we want to continue to encourage developers to help us spread the PhishTank community’s work to as many places as possible. There won’t be one way, but many.
We know the PhishTank API documentation would benefit from code examples, so if there’s good stuff out there people are willing to share, please let us know.


David Branco
Wow, Thanks John Roberts for the post. I’d just like to say that the code I used to debug/test this Class can be found below. (For use once first_run() has been completed) Note: This class was made to be usable in PHP 4 as well as PHP5. Any feedback whether you LOVE my work or even HATE it, with reasons why, will be greatly appreciated.
PHP Used:
start_session();
echo ‘Time: ‘.$tanker->response_meta[’timestamp’].'’;
echo ‘Token: ‘.$tanker->token.'’;
echo ‘API Key: ‘.$tanker->api_key.'’;
echo ‘Frob: ‘.$tanker->frob.'’;
($tanker->session_active) ? $active = ‘Yes’ : $active = ‘No’;
echo ‘Session Active: ‘.$active.'’;
echo ‘’;
if(!$tanker->misc_ping())
echo $tanker->error.'’;
else
echo ‘Pong: ‘.$tanker->response[’pong’].'’;
echo ‘’;
if(!$tanker->check_url(’http://phishtank.com’))
echo $tanker->error.'’;
else
echo ‘Check Url: ‘.print_r($tanker->response[’url0′]).'’;
echo ‘’;
$tanker->end_session();
($tanker->session_active) ? $active = ‘Yes’ : $active = ‘No’;
echo ‘Session Active: ‘.$active.'’;
?>
— posted by David Branco on November 10th, 2006 at 12:42 am
Nitish Padgaonkar
Hi,
I too was writing a PHP class for PEAR implementing the PhishTank API, but had some problems with implementing check.email. It’s not 100% finished, but I suppose I can post what I’ve done so far. It’s PHP 5+ compliant and aims to be as standards abiding as possible with regard to the new PEAR standards due to be in effect by January 2007.
The link is posted below:
http://team254.bcp.org/Services/PhishTank.php.txt
— posted by Nitish Padgaonkar on November 11th, 2006 at 6:35 am
David Hall
On the api page, the example code is missing a sort($parameters); call that can be found in both the classes above. I thought I could save some people some time by pointing this out. (The first class uses asort, which works, but sort is better, which is used by the second class listed here).
— posted by David Hall on December 25th, 2006 at 4:36 am
Luskaner
What should i put in ‘$api_key’? cause i put others ($username, $app_key, $shared_secret) in account details with registering a new application
— posted by Luskaner on February 8th, 2007 at 5:46 pm