Jump to content

Import credit from csv


lordam

Recommended Posts

Hello, please hellp.

I have csv file:

id_client;amount;description;

id_client2;amount2;description2;

id_client5;amount4;description3;

 

I need import this date in WHMCS Credit.

 

But when i check API i see nothing.

 

<?php

$url = "https://url/includes/api.php"; # URL to WHMCS API file
$username = "admin@admin.com"; # Admin username goes here
$password = "xxx"; # Admin password goes here

$postfields["username"] = $username;
$postfields["password"] = $password;
$postfields["action"] = "addcredit";
$postfields["clientid"] = "37";
$postfields["description"] = "Adding funds via custom module";
$postfields["amount"] = "40.00";

?>

Link to comment
Share on other sites

  • 3 weeks later...

About CSV code it now.

I have problem with code:

<?php

 

$url = "https://url/includes/api.php"; # URL to WHMCS API file

$username = "admin@admin.com"; # Admin username goes here

$password = "xxx"; # Admin password goes here

 

$postfields["username"] = $username;

$postfields["password"] = $password;

$postfields["action"] = "addcredit";

$postfields["clientid"] = "37";

$postfields["description"] = "Adding funds via custom module";

$postfields["amount"] = "40.00";

 

?>

 

I can not add credit using thise example code, where the error?

Link to comment
Share on other sites

  • 3 weeks later...

now i using code:

<?php

$url = "https://domen/includes/api.php"; # URL to WHMCS API file

$username = "admin"; # Admin username goes here

$password = "xxxxxx"; # Admin password goes here

 

$postfields["username"] = $username;

$postfields["password"] = md5($password);

$postfields["action"] = "addcredit";

$postfields["clientid"] = "17";

$postfields["description"] = "Adding funds via custom module";

$postfields["amount"] = "40.00";

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_TIMEOUT, 100);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

$data = curl_exec($ch);

curl_close($ch);

 

$data = explode(";",$data);

foreach ($data AS $temp) {

$temp = explode("=",$temp);

$results[$temp[0]] = $temp[1];

}

 

if ($results["result"]=="success") {

} else {

# An error occured

echo "The following error occured: ".$results["message"];

}

?>

 

but not add credit.

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.

  • 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