how to post file to Apache AB

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MacRules

    how to post file to Apache AB

    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($m ysqli, $sql);

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

    mysqli_close($m ysqli);
    }


    $ cat insert_post.txt
    testfield=newon e

    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?
  • Jerry Stuckle

    #2
    Re: how to post file to Apache AB

    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($m ysqli, $sql);
    >
    if ($res === TRUE) {
    echo "A record has been inserted.";
    } else {
    printf("Could not insert record: %s\n",
    mysqli_error($m ysqli));
    }
    >
    mysqli_close($m ysqli);
    }
    >
    >
    $ cat insert_post.txt
    testfield=newon e
    >
    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.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • John Murtari

      #3
      Re: how to post file to Apache AB

      MacRules <MacRules@nospa m.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($m ysqli, $sql);
      >
      if ($res === TRUE) {
      echo "A record has been inserted.";
      } else {
      printf("Could not insert record: %s\n",
      mysqli_error($m ysqli));
      }
      >
      mysqli_close($m ysqli);
      }
      >
      >
      $ cat insert_post.txt
      testfield=newon e
      >
      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.
      johnm@thebook.c om "software that fits!" (TM)
      Toll Free (877) 635-1968(x-211) http://www.thebook.com/

      Comment

      Working...