Jump to content

API doesn't answer correctly


Recommended Posts

Good morning,

I'm using API to sync pricing between WordPress and WHMCS, using GetProducts. The problem is when I make the request with a specific pid, there is no result (totalresult = NULL). But when I don't specify pid, all products are in the result, including the pid which I specified. What's wrong? Here is my code:

<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://path.to.whmcs/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
  http_build_query(
    array(
      'action'        => 'GetProducts',
      'username'      => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'password'      => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'responsetype'  => 'json',
      'pid'           => 53
    )
  )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response);

var_dump($response);

?>

 

Link to comment
Share on other sites

  • 3 weeks later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated