Jump to content

TCAdmin with cURL and PHP


JoshUGT

Recommended Posts

I've talked withe people at TCAdmin and theyre only able to provide a certain amount of support, as there script was written in ASP.NET. However, ModernBill does it, and my script somewhat does too... Its supposed to post to the billingapi file and create a new server / user... however it creates the server and assigns it an owner, but there never is a user added.

 

Thanks in advance for any help as to why this isnt working.

 

The problem is: It will post fine to the server, a game server will start, with the user as the OWNER, but when, in TCADmin, I go to users... there isnt a user there that should be. Am i missing something?

 

Here is the code (certain parts removed for security):

 

<?
// declare array
$post_data = array();

// Standard Information
$post_data[tcadmin_username] = "ADMINUSER";// tc admin user
$post_data[tcadmin_password] = "ADMINPASS"; // tc admin pass
$post_data['function'] = "AddPendingSetup"; // tc admin function: AddPendingSetup
$post_data[response_type] = "xml"; // response type from tca - text

$post_data[skip_page] = "1"; // if set to 1 will auto create; 0 will email with a link to configure
// Billing information
$post_data[game_package_id] = "4"; // package id for game server
$post_data[client_id] = "66"; // clients billing id

/* Auto-generate */
$post_data[user_name]  = "mojojojo"; // username
$post_data[user_password] = "tc1234566"; // user_password

// User info
/* Stuff to clean from forms */
$post_data[user_email] = "joe@test.com"; // email
$post_data[user_fname] = "Moe"; // first name
$post_data[user_lname] = "Rend"; // last name
$post_data[user_address1] = "430 Koy Street"; //addr1
$post_data[user_address2] = ""; // addr2
$post_data[user_city] = "Kissimmee"; // city
$post_data[user_state] = "Florida"; // state
$post_data[user_zip] = "32900"; // zip code
$post_data[user_country] = "USA"; // country
$post_data[user_phone1] = "40777777"; // phone #
$post_data[user_phone2] = ""; // alt phone #

// For game servers
$post_data[game_id] = "10"; // game id of game ( css, aao, bf2, etc ) from TCAdmin
$post_data[game_slots] = "16"; // server slots
$post_data[game_private] = "0"; // 1 if private; 0 if public


/* Required for skip page */
$post_data[game_datacenter] = "TC0633808447606"; // game server location / name
$post_data[game_hostname] = "Joshs Test Server"; // servers game name
$post_data[game_rcon_password] = "test"; // rcon pw
$post_data[game_private_password] = ""; // generate pass if private

				   $url = "http://IPADDR/billingapi.aspx";
				
				   $o="";
				   foreach ($post_data as $k=>$v)
				   {
					   $o.= "$k=".utf8_encode($v)."&";
					   echo "$k = $v ::: ".utf8_encode($v)." <br>";
				   }
				   $post_data=substr($o,0,-1);
				  
				   $ch = curl_init();
				   curl_setopt($ch, CURLOPT_POST, 1);
				   curl_setopt($ch, CURLOPT_HEADER, 0);
				   curl_setopt($ch, CURLOPT_URL, $url);   
				   curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
				  $result = curl_exec($ch);
				  echo nl2br($result);

?>

Link to comment
Share on other sites

He said he used a file called create.html, im not sure how he used that because i pointed him to a file called variables.php ( which is the form / html file ) and told him that was it, and he said he used a file called create.htm (from another server?) and it worked....

Link to comment
Share on other sites

Did the file that he send to you work?

 

I think he was trying to tell you that his example worked, but yours did not. He gave you the page so you could look at the code to figure out what was wrong in your script.

 

Again, this is second hand, as you spoke to him directly in the ticket.

Link to comment
Share on other sites

Going over the ticket that you have open with Luis. He sent you a zip file containing a file called create which is what contained the proper setup code.

 

He said he ran it and it created a user which he showed you. Your next question was "Why doesn't mine work?" I think that is where you got lost. He wasn't troubleshooting your script, he was saying open the create file he sent you and look at the code to try and figure out what was in there that was not in yours.

 

In other words, he isn't going to troubleshoot your script for you. He had given you a properly working page to base your script off of.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Who's Online   0 Members, 0 Anonymous, 17 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use