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

how to post file to Apache AB

P: n/a
Here is my insert.php,

$ cat insert.php
<?php
$mysqli = mysqli_connect("localhost", "joeuser", "somepass", "testDB");

if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
$sql = "INSERT INTO testTable (testField) VALUES
('".$_POST["testfield"]."')";
$res = mysqli_query($mysqli, $sql);

if ($res === TRUE) {
echo "A record has been inserted.";
} else {
printf("Could not insert record: %s\n",
mysqli_error($mysqli));
}

mysqli_close($mysqli);
}
$ cat insert_post.txt
testfield=newone

Is this correct here?

$ ab -p ./insert_post.txt http://local/Sites/insert.php

Is the insert_post.txt and insert.php required to be in the same subdir?
Oct 15 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
MacRules wrote:
Here is my insert.php,

$ cat insert.php
<?php
$mysqli = mysqli_connect("localhost", "joeuser", "somepass", "testDB");

if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
$sql = "INSERT INTO testTable (testField) VALUES
('".$_POST["testfield"]."')";
$res = mysqli_query($mysqli, $sql);

if ($res === TRUE) {
echo "A record has been inserted.";
} else {
printf("Could not insert record: %s\n",
mysqli_error($mysqli));
}

mysqli_close($mysqli);
}
$ cat insert_post.txt
testfield=newone

Is this correct here?

$ ab -p ./insert_post.txt http://local/Sites/insert.php

Is the insert_post.txt and insert.php required to be in the same subdir?
ab is an apache program. Try one of the Apache newsgroups.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Oct 15 '08 #2

P: n/a
MacRules <Ma******@nospam.comwrites:
$ cat insert.php
<?php
$mysqli = mysqli_connect("localhost", "joeuser", "somepass", "testDB");

if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
$sql = "INSERT INTO testTable (testField) VALUES
('".$_POST["testfield"]."')";
$res = mysqli_query($mysqli, $sql);

if ($res === TRUE) {
echo "A record has been inserted.";
} else {
printf("Could not insert record: %s\n",
mysqli_error($mysqli));
}

mysqli_close($mysqli);
}
$ cat insert_post.txt
testfield=newone

Is this correct here?

$ ab -p ./insert_post.txt http://local/Sites/insert.php

Is the insert_post.txt and insert.php required to be in the same subdir?

No, the insert_post.txt file should be local to the machine
where you are running ab -- it will send that data to the php script
running on the server.

Best regards!

--
John
__________________________________________________ __________________
Customer Service Software Workshop Inc.
jo***@thebook.com "software that fits!" (TM)
Toll Free (877) 635-1968(x-211) http://www.thebook.com/
Oct 16 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.