How to convert url data for htm forms or MySQL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • G4G
    Corporal

    • Jul 2006
    • 13

    How to convert url data for htm forms or MySQL

    My name is Pieter de Waal and my account ID is 9140


    I receive form data from ClickBank in an url every time a customer pays.
    I have figured how to extract this data using php, but not how to forward it to my MySQL database.

    I know how to create forms and forward it to my dtabase using html.

    Is it possible to get the php data to be used in my html form? If not, what are the alternatives?

    Can anyone point me in the right direction please.
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: How to convert url data for htm forms or MySQL

    You don't need to place the data in a html form in order to store it in the database.
    Once the data is retreived from Clickbank, it is immediatelly available for database storing. What you need to do is this:

    1. Retreive the data from clickbank. The data will usually be in the form of an array. Assign this data to local variables. Just as an example, supose that you get these three values:
    a. client_name stored in a variable : $client_name
    b. client_email stored in a variable: $client_email
    c. amount stored in a variable $amount

    2. Following the script that retrieves the data and assigns the values to local variables, add a some lines of code like: (which makes the assumption that your table fileds, are also named "client_name", "client_email", "amount" ).

    $db = mysql_connect($db_host, $db_user, $db_password);
    if ($db == FALSE){
    $error = "Could not connect to the Database Server. Please check user details ! !";
    $_SESSION[error] = $error ;
    mysql_close($db);
    header("Location: errorpage.php");
    exit;
    }


    if (!mysql_select_db($db_name, $db)) {
    $error = "Could not select database. Please check Database details !";
    $_SESSION[error] = $error ;
    mysql_close($db);
    header("Location: errorpage.php");
    exit;
    }


    @$query = 'INSERT INTO `your_table`('
    . ' `client_name` ,'
    . ' `client_email`,'
    . ' `amount`'
    . ' )';

    @$query .= "VALUES ("
    . " \"$client_name\" ,"
    . " \"$client_email\","
    . " \"$amount\""
    . " )";

    //--- For debugging purposes only----
    //echo "Query = $query****";
    //exit;

    //insert standard record
    $result = mysql_query($query);
    if (!$result) {
    $_SESSION[error] = "Invalid Query: $query . The error is: ". mysql_error() . " Please contact the site administrator at youremail@example.com";
    mysql_close($db);
    header("Location: errorpage.php");
    exit;
    }
    mysql_close($db);
    }

    Of course, your_table , errorpage, and youremail@example.com are to be customized for your own details. Also, the part in read, is usually NOT part of the script, but it is included with the include() command. I only used it here to show you how it should be.

    As you can see, i prefer NOT to make the script "die" in case of error, but to send the error message to a "errorpage.php" which will display the error properly, in a html template. Of course, this requires also some instruction in the start of your code, to make error reporting work: error_reporting(0);
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    • G4G
      Corporal

      • Jul 2006
      • 13

      #3
      Re: How to convert url data for htm forms or MySQL

      Hi again

      It looks like you went to a lot of trouble. I will see what I can do with this.

      Thanks.

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #4
        Re: How to convert url data for htm forms or MySQL

        No, no trouble at all. This is standard code i use in my own scripts.
        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment

        • G4G
          Corporal

          • Jul 2006
          • 13

          #5
          Re: How to convert url data for htm forms or MySQL

          Hi again

          Trouble or no trouble. I appreciate it. Unfortunately I will have to bother you again.

          I looked at your scripts. All I know about php is a very basic tutorial and a limited amount of common sense, so you lost me a few times. But let's just take it one step at a time.

          First things first. The reason I needed/wanted to link the php & html data is twofold:

          1. My Autoresponder(ARP) provides me with ready-made html scripts for my forms, so I don't have to bother with passwords etc. For your info - they use the following method: <form method='POST' action='http://www.*path* formcapture.pl'>. It works fine.

          Yes, that's standard procedure for autoresponders. Your form post directly to a script on their site, and their script takes care of storing the info in the database.


          2. Clicbank does not provide me with all the required client data. I have to add (at least) the first name and e-mail to the same MySQl db file. CB does provide me with an option though of sending additional QUERY_STRING parameters to the payment link. This can be written into the order form and passed back to me after payment together with their basic payment data. I understand the concept, but not much more.

          There is a simple way of doing this: after payment, clickbank redirects the client back to your site, and at the same time it sends some information like payment status, client email etc. Also, they send an identification token, which can be used to create a connection back to Clickbank (as a verification, mainly used for instantly downloadable products where there is no time to wait for manual processing of the order). So, if the info they send you with the redirect is enough, and you don't have particular verification problems, you take the info from there, otherwise you open a connection slot back to them (automatically) and querry their database based on the identification token. They then provide you with all the details available (exept those which are personal details of the client) in their database. I use this method for my Instant download Cart with PayPal.


          SCRIPT PROBLEMS:

          In trying to use your script I hit some hiccups. Firstly username and password. I started using the info from my Control Panel. Then I tried my Vodahost login and finally even my ARP login. Each one gave me back exactly the same error:

          Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'sdszbwa'@'localhost' (using password: NO) in /home2/sdszbwa/public_html/@cbdata.php on line 10

          No. If you have already setup a database in your CP, then you most probably have also created a user and relevant password.
          If the user you have created is, i.e. "john" the actual user will be ""sdszbwa_john". The Same goes for the database: if the database is, i.e. named "clickbank", the actual database name is "sdszbwa:clickbank".

          Also, please make sure that you have added the user to the database in question, otherwise acess will be denied anyway.


          a. Does this make sense to you? Obviously I am doing something wrong.

          b. Can you please guide me into getting the two sources of data to the same db, please?

          Let me understand, because i don't think i have the full picture: there is ONE database related to your autoresponder. However, if this is an external service, this database is NOT on your site. The same goes for the Clickbank database.
          And, if i understand well, you have a database (related to your shopping cart ?) where the info of the order is stored.
          And, you want the data from the clickbank, to be stored in the same database as the order info ?

          However, this is not (or at least i beleive so) something that you can do if you have no experience of php and MySQL coding. Also, it requires a study of Clickbank's APIs to see how to connect to their slot and retreive the info.
          Please provide some details, and a link to the pages you have published.



          This will be greatly appreciated.
          Thanks

          PDW

          Comment

          • navaldesign
            General & Forum Moderator

            • Oct 2005
            • 12080

            #6
            Re: How to convert url data for htm forms or MySQL

            Please have a look above.
            Navaldesign
            Logger Lite: Low Cost, Customizable, multifeatured Login script
            Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
            DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
            Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

            Comment

            • G4G
              Corporal

              • Jul 2006
              • 13

              #7
              Re: How to convert url data for htm forms or MySQL

              Hi

              No. The database is actually on my site. Autoresponse Plus installed it for me there and I can access it via my Vodahost Control Panel as well.

              ------------

              The page that will take the client to ClickBank is :



              I need something between this and the actual product page.

              Specifically I need their e-mail info so that I can send them follow-up using the Autoresponder. I also need proof of payment.

              At present ClickBank will forward them to :


              This is a temporary link that I am using to experiment with.
              After this pge they will be directed to my donload page.

              Thank You
              PDW

              Comment

              • navaldesign
                General & Forum Moderator

                • Oct 2005
                • 12080

                #8
                Re: How to convert url data for htm forms or MySQL

                Ok, you need some script that will receive the data from clicbank, and store it in your database. The same script can verify the payment and allow or disallow the download.

                However, this is by far a complicated script, it has taken me almost 20 days to set up my own Instant Download Cart, and i consider myself experienced with php.

                In other words, whilst the core for the database storing part is as i have posted above, this exceeds what can be done simply giving you instructions. Here is how IDC works (only with PayPal at the moment):

                The user orders (one or more items).
                The order details are stored in the database, and then the customer is taken to an "Order preview" page. He is then automatically taken to PayPal, where he payes and he is taken back to your site.

                the script here performs a number of tasks:
                receives the data from PayPal, opens a connection slot with them, and retreives al possible details from them (email, name, transaction ID, country of residence etc) . It checks if the payment is complete or not (as in the case of e checks). If the payment is completed, it redirects to a download page, where all the product links are displayed. It also sends a email to the customer, with his order details and a re-download link for future use, and stores the data in the Orders Database (in your case it could also update the Autoresponder database). If it finds that the payment is incomplete, displayes a page where it informs the customer that his order will be manually processed upon payment confirmation. If it finds that there is no correspondance between PayPal details and order details, it recognizes the visit as an illegitimate attempt to download the products. It will however, in this case, prompt the customer to contact the site administrator, through an automated contact form.

                All these features, have to be built with lits of security checks, to avoid problems.

                It is not something you can do so easily, it requires lots of time and experience.

                A simpler solution, only to update the Autoresponder database, requires a simple script to be added after the point you have (as you said) already extracted the info from the Clickbank post and you simply need to store the email, name etc in the autoresponder database.

                I can do this for you, if you want contact me.
                Navaldesign
                Logger Lite: Low Cost, Customizable, multifeatured Login script
                Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                Comment

                • G4G
                  Corporal

                  • Jul 2006
                  • 13

                  #9
                  Re: How to convert url data for htm forms or MySQL

                  Hi

                  I see that you understand the situation fairly well.

                  The long solution is of course what I ideally would want. The shorter one is all that I would have tried to attemp myself at this stage.

                  I will take you up on your offer. I will contact you to sort out the details.

                  Thanks

                  PDW

                  Comment

                  Working...
                  X