This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Pages: [1]
1
Functions / CWP accoutn API
« on: November 23, 2016, 07:21:58 PM »
Hello,
my first post here
I am trying to build a module for user registration with payment etc.
I am facing the following problem:
What would be the best approach with the account api ? I am currently trying to use cURL. First the user fills in a form with its desired username, password etc. The form is then submited with POST method to a php file where I am initiating curl session where we pass the form variables to the url, but I always get empty response from server or I get an error that the username is already in the database even if it actually isn't.
my code:
Would you be so kind and help me with the best way to achieve what I want ?
my first post here
I am trying to build a module for user registration with payment etc.
I am facing the following problem:
What would be the best approach with the account api ? I am currently trying to use cURL. First the user fills in a form with its desired username, password etc. The form is then submited with POST method to a php file where I am initiating curl session where we pass the form variables to the url, but I always get empty response from server or I get an error that the username is already in the database even if it actually isn't.
my code:
Code: [Select]
<?php
$username = $_POST["username"];
$password = $_POST["password"];
$domain = $_POST["domain"];
$email = $_POST["email"];
$key = "abv123";
$api = "account_new";
$url = 'http://ip:2030/api/?key='.$key.'&api='.$api.'&domain='.$domain.'&username='.$username.'&password='.$password.'&package=1&email='.$email.'&inode=10000&nofile=100&nproc=25';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$tmp = curl_exec($ch);
curl_close($ch);
if ($tmp === false){
return $tmp;
}
else { echo "success!"; }
?>
Would you be so kind and help me with the best way to achieve what I want ?
Pages: [1]