By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,650 Members | 753 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,650 IT Pros & Developers. It's quick & easy.

fopen to curl

P: 1
My web host has disabled fopen and now uses curl. I am a newbie to php so I am at a complete loss. I am trying to change the code in sendcard at to use curl.
The beginning login will not connect. The code for this is below.

$error = "";

if($cfg_admin_password1 != "" || $cfg_admin_password2 != "") {
if ($cfg_admin_password1 == $cfg_admin_password2) {
$cfg_admin_password = md5($cfg_admin_password1);
$session["password"] = $cfg_admin_password;
$_SESSION['session']['password'] = $cfg_admin_password;
} else {
$output_msg = "Sorry, your two passwords did not match";

if(!$output_msg) {
$cnt = "";
$cnt .= "<?php\n";
$cnt .= "define(\"DOCROOT\", \"$cfg_docroot\");\n";
$cnt .= "define(\"SENDCARD_HOST\", \"$cfg_sendcard_host\");\n";
$cnt .= "define(\"SENDCARD_DIR\", \"$cfg_sendcard_dir\");\n";
$cnt .= "define(\"ADMIN_PASSWORD\", \"$cfg_admin_password\");\n";
$cnt .= "\$first_time = 0;\n";
$cnt .= "?";
$cnt .= ">";

$file = fopen("config.php", "w+");
fwrite ($file, $cnt);
fclose ($file);
$output_msg = "Changes saved!";

if ($DOCROOT == "") {

if ($SENDCARD_HOST == "") {

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Administration area settings</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body bgcolor="#ffffff">

<h2><?php echo($output_msg); ?></h2>

<form method="post" action="setup.php">
<p>Please check that this is the directory you installed sendcard in (from your
top public directory). You must include a trailing slash.<br>
<input type="text" name="cfg_sendcard_dir" value="<?php echo (SENDCARD_DIR); ?>">
<p>Please check that this is the full path to the directory you installed sendcard in.
You must include a trailing slash.<br>
<input type="text" name="cfg_sendcard_host" value="<?php echo ($SENDCARD_HOST); ?>">
<p>So is this the full system path to the directory where sendcard.php is? It must have a trailing slash.<br>
<input type="text" name="cfg_docroot" value="<?php echo ($DOCROOT); ?>">
<p>If you wish to change your password, please enter a password and confirm it.
If you do not wish to change it, please leave these boxes blank.<br>
<input type="password" name="cfg_admin_password1"><br>
<input type="password" name="cfg_admin_password2">
<input type="hidden" name="cfg_admin_password" value="<?php echo (ADMIN_PASSWORD); ?>">
<input type="submit" name="save" value="Save">
<input type="reset" name="reset" value="Reset">

Can someone please tell me what to change, and thanks ahead.
Jan 8 '08 #1
Share this Question
Share on Google+
1 Reply

P: 93
I might be wrong but at a quick glance it looks like you're using fopen to open/write to a file on your local server. cURL is usually used to access other servers via http. Although having said that I think you can connect to your own server using curl, but it would be just like a normal web user connecting to your server, i.e. it wouldn't allow you to write to a file, so it would be pointless! Not sure...anyone else?..
Jan 8 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.