sending some data from my site to another site

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kamill
    New Member
    • Dec 2006
    • 71

    sending some data from my site to another site

    Dear All,
    I need to send some data from my site to another site, but i do not want to hit that site. Is there any option.
    Currently i am using form to doing it but after submitting it, i do not want to transfer control to another site.
    I needed immediate help.
    Thanking you.

    Regards
    Kamill

    [PHP]
    <form action="memberl ogin.php" method="get" >
    <input type="hidden" name="Amount[]" value="<?php echo $product_final_ price ?>" />
    <input type="hidden" name="Order_Cod e[]" value="<?php echo $myorder_code ?>" />
    <input type="hidden" name="Subscript ion_ID[]" value="<?php echo $product_unit ?>" />
    <input type="hidden" name="Username" value="<?php echo $usernamee ?>" />
    <input type="hidden" name="Email" value="<?php echo $useremaill ?>" />
    <input type="hidden" name="Remarks" value="<?php echo $customer_note ?>" />
    <input type="submit" name="submit" value="OK" />
    </form>

    [/PHP]
  • nathj
    Recognized Expert Contributor
    • May 2007
    • 937

    #2
    Hi Kamill,

    If I understand you correctly you are submiting data from your site to a secondary site. Is this correct?

    If so the second site needs to receive the data then set the header location back tot refereing page - your site. In this way the data will be received and processed and the user will see the page they started on. Alternatively you could, via the $_POST data send the page you wish the user to be returned to on your site.

    The header code would look like this:
    [php]
    header("Locatio n:targetpage.ph p"); // this may also include a query string
    [/php]

    It seems to me that you need to speak with the people responsible for the site you are posting to.

    If, however, you mean that one page on your site is posting to another page that you don't want displayed then theory is the same, but the execution is easier as you control it all.

    I hope that helps you out.

    Cheers
    nathj
    Last edited by nathj; Aug 7 '07, 07:05 AM. Reason: adding some code

    Comment

    • kamill
      New Member
      • Dec 2006
      • 71

      #3
      Hi Nathi
      Thanks for quick repply.Actually My code is something like this,

      =============== =============== =============== =============== =============== ======[/font][/size][/font]

      [PHP]


      <?php

      for($i=0;$i<$n; $i++)

      {

      $query="select * from `mytable` where `id`='$i'";

      ?>

      <form action="<?php echo $i ?>.php" method="get" >

      <input type="hidden" name="a" value="<?php echo $a ?>" />

      <input type="hidden" name="b" value="<?php echo $b ?>" />

      <input type="hidden" name="c" value="<?php echo $c ?>" />

      </form>

      <?




      }

      ?>[/PHP]
      i need to submit the form(on each itteration) without refreshing the page, Please help me.[/font][/size][/font]

      Comment

      • nathj
        Recognized Expert Contributor
        • May 2007
        • 937

        #4
        The first thing I have to know is do you have control over how the target site works?

        If so then you could load the data to the $_SESSION on each loop trhough then laod the target page, read the $_SESSION variables and re-direct the browser to where you want it to be.

        However, if you do not have control over the second site then this could be a problem. Also I am not sure if this would work across domains.

        Hopefully this will help you out.

        Cheers
        nathj

        Comment

        • nukephp
          New Member
          • Aug 2007
          • 7

          #5
          you should have access priviledge of another site those u sending data.........

          As well u hv knwledge the working of second website that u can gain the variable control on your site........... .....

          Processing language should be same........... ....of both site........... ...
          then u can access that site........... ............... .

          Comment

          • ak1dnar
            Recognized Expert Top Contributor
            • Jan 2007
            • 1584

            #6
            Originally posted by nukephp
            Processing language should be same........... ....of both site........... ...
            then u can access that site........... ............... .
            No my dear, Its Not correct.
            As far as you transferring POST/GET data over HTTP protocol, language is not a issue. for example Here on your site say you are using PHP. You have a Form setup here and processing script for the form is an ASP page that is on a Different domain. Since ASP is accepting HTTP requests you can transfer your Post/Get data back and forth.

            And for the Original Poster's Question: You better to try some AJAX if you do not wish to redirect back to the Target domain's Script.

            Comment

            • kamill
              New Member
              • Dec 2006
              • 71

              #7
              I do not have any knowledge about Ajax, can you post some sample code here.
              Originally posted by ajaxrand
              No my dear, Its Not correct.
              As far as you transferring POST/GET data over HTTP protocol, language is not a issue. for example Here on your site say you are using PHP. You have a Form setup here and processing script for the form is an ASP page that is on a Different domain. Since ASP is accepting HTTP requests you can transfer your Post/Get data back and forth.

              And for the Original Poster's Question: You better to try some AJAX if you do not wish to redirect back to the Target domain's Script.

              Comment

              • nathj
                Recognized Expert Contributor
                • May 2007
                • 937

                #8
                Originally posted by kamill
                I do not have any knowledge about Ajax, can you post some sample code here.
                The best thing to do is work through a tutorial. then you will be able to see what it can do before you think about how you can use it.

                Cheers
                nathj

                Comment

                • gregerly
                  Recognized Expert New Member
                  • Sep 2006
                  • 192

                  #9
                  There is another way with PHP that you can post data to another site without leaving your site. It's called CURL. It's used on many payment gateways to send data and receive a response without leaving your site. Look into the CURL library for PHP and it may be what your looking for.

                  Greg

                  Comment

                  • ak1dnar
                    Recognized Expert Top Contributor
                    • Jan 2007
                    • 1584

                    #10
                    Oh my bad, yeap CURL is also a good point to start over. Nice work greg !

                    Comment

                    • gregerly
                      Recognized Expert New Member
                      • Sep 2006
                      • 192

                      #11
                      Originally posted by ajaxrand
                      Oh my bad, yeap CURL is also a good point to start over. Nice work greg !
                      My pleasure. I only recently started using it to utilize other web services, and read RSS feeds into my websites. Works like a charm!

                      Greg

                      Comment

                      Working...