cPanel db Creator script

cPanel db Creator script

am 21.07.2007 03:01:30 von Paul Smith

------=_NextPart_000_0019_01C7CB3B.0E31C440
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I hope I am doing this write as this is the first time I've sent a =
message to a mailing list!

I have a php script that uses cPanel to create a database. It requires =
the cURL to be installed and my webhost has confirmed to me that it is =
installed.

I have not been able to get the script to work and so emailed my webhost =
for help. Their reply was "You may need to configure your script to use =
PHP's built-in cURL function in order to get this to work instead of the =
CLI cURL."

Now, I am not well experienced yet but am learning fast. This is the =
first time I've come across cURL so I am at a complete loss and wondered =
if someone could help me with this. Here's the script I have.


// cPanel username

$cpanel_user =3D "******";

// cPanel password

$cpanel_password =3D "******";

// cPanel host

$cpanel_host =3D "*******";

// cPanel theme/skin, usually "x"

$cpanel_skin =3D "x";

$db_name =3D "testing";

// Path to cURL on your server

$curl_path =3D "/usr/bin/curl";

//////////////////////////////////////

/* Code below should not be changed */

//////////////////////////////////////

if(isset($_GET['db']) && !empty($_GET['db'])) {

// escape db name

$db_name =3D escapeshellarg($_GET['db']);

// will return empty string on success, error message on error

$result =3D exec("$curl_path =
'http://$cpanel_user:$cpanel_password@$cpanel_host:2082/fron tend/$cpanel_=
skin/sql/adddb.html?db=3D$db_name'");

// output result

echo $ch;

}

else {

echo "Usage: cpanel_create_db.php?db=3D$db_name";

}

?>

Thanks in advance to anyone who has a clue how to solve this!!!

Paul.

------=_NextPart_000_0019_01C7CB3B.0E31C440--

Re: cPanel db Creator script

am 23.07.2007 02:20:27 von dmagick

Paul Smith wrote:
> I hope I am doing this write as this is the first time I've sent a message to a mailing list!
>
> I have a php script that uses cPanel to create a database. It requires the cURL to be installed and my webhost has confirmed to me that it is installed.
>
> I have not been able to get the script to work and so emailed my webhost for help. Their reply was "You may need to configure your script to use PHP's built-in cURL function in order to get this to work instead of the CLI cURL."

See the examples on this page:

http://php.net/curl

You might need to set the 'CURLOPT_PROXYAUTH' options to handle the
cpanel login window:

http://www.php.net/manual/en/function.curl-setopt.php

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php