Jump to content
MakeWebGames

Fraud Guard IO


TheMasterGeneral

Recommended Posts

Greetings MWG!

Recently, [uSER=65371]sniko[/uSER] made mention of FraudGuard.IO in this thread.

Personally, I'm not the greatest at PHP, so my knowledge on the subject itself is quite limited. I'm trying to implement the API of Fraudguard into a project I'm working on. Did a few hours of reading PHP manual and random googling, and came up with an almost completed CURL query.

 

$params=['username'=>'minenotyours', 'password'=>'suoytonenim'];
                   $defaults = array(
                   CURLOPT_URL => "https://api.fraudguard.io/ip/1.1.1.1",
                   CURLOPT_POST => false,
                   CURLOPT_POSTFIELDS => $params,
                   CURLOPT_SSL_VERIFYPEER => false,
                   );
                   $ch = curl_init();
                   curl_setopt_array($ch, $defaults);
                   if(!curl_exec($ch)){
                       die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
                   }

 

Anyway, this results in a "Whoops, looks like something went wrong" error, which tells me the request was sent successfully. (As its a result straight from the API itself.) I don't think it has an issue to do with the $parmas being invalid, as the API itself says it'd return a Bad Authentification error if that was the case. Has anyone used this API before, or am I treading alone here? :D

Any help would be appreciated.

Edit: I'm open to the idea of not having to use curl if needed.

Link to comment
Share on other sites

Fun fact; Fraudguards API is written with Lumen, Laravel's micro-framework. Which is why you get the error "Whoops, looks like something went wrong" (typical Laravel).

Anyhow, it would be ideal for you to write a class, to better handle errors. But, if (as you say), you're not the greatest with PHP, this could prove a little difficult.

This will work:

$curl = curl_init();

curl_setopt_array($curl, array(
   CURLOPT_URL => 'https://api.fraudguard.io/ip/1.1.1.1',
   CURLOPT_USERPWD => 'username:password'
));

$resp = curl_exec($curl);

var_dump($resp);
Edited by IllegalPigeon
Removed un-needed code
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...