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

sending some data from my site to another site

kamill
P: 71
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="memberlogin.php" method="get" >
<input type="hidden" name="Amount[]" value="<?php echo $product_final_price ?>" />
<input type="hidden" name="Order_Code[]" value="<?php echo $myorder_code ?>" />
<input type="hidden" name="Subscription_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]
Aug 7 '07 #1
Share this Question
Share on Google+
10 Replies


nathj
Expert 100+
P: 938
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("Location:targetpage.php"); // 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
Aug 7 '07 #2

kamill
P: 71
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]
Aug 7 '07 #3

nathj
Expert 100+
P: 938
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
Aug 7 '07 #4

P: 7
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...........................
Aug 7 '07 #5

ak1dnar
Expert 100+
P: 1,584
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.
Aug 7 '07 #6

kamill
P: 71
I do not have any knowledge about Ajax, can you post some sample code here.
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.
Aug 9 '07 #7

nathj
Expert 100+
P: 938
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
Aug 9 '07 #8

gregerly
Expert 100+
P: 192
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
Aug 9 '07 #9

ak1dnar
Expert 100+
P: 1,584
Oh my bad, yeap CURL is also a good point to start over. Nice work greg !
Aug 10 '07 #10

gregerly
Expert 100+
P: 192
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
Aug 10 '07 #11

Post your reply

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