473,385 Members | 1,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Posting with out Submit - posted to page does nothing

6
Hello All,

I am posting to a page with out a submit button using the function sendToHost - http://dodds.net/~cardinal/sendtohost.txt

I send the following
sendToHost('www.example.com','post','/page.php', 'ERROR=01');
where www.example.com is my site.

The problem then is that page.php on the site should then read from the $_POST variable and write out the Error to the file.

My code for page.php -

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w');
fwrite($fh, $_POST['ERROR']);
fwrite($fh, "done");
fclose($fh);

The problem then continues that the page.php file does not write this info out. Do you know how I would be able to get the page.php file to do this or to make sure that the post is actually being sent.

Thanks
Mar 25 '08 #1
6 2727
hsriat
1,654 Expert 1GB
Hello All,

I am posting to a page with out a submit button using the function sendToHost - http://dodds.net/~cardinal/sendtohost.txt

I send the following
sendToHost('www.example.com','post','/page.php', 'ERROR=01');
where www.example.com is my site.

The problem then is that page.php on the site should then read from the $_POST variable and write out the Error to the file.

My code for page.php -

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w');
fwrite($fh, $_POST['ERROR']);
fwrite($fh, "done");
fclose($fh);

The problem then continues that the page.php file does not write this info out. Do you know how I would be able to get the page.php file to do this or to make sure that the post is actually being sent.

Thanks
Check if the variables are being posted actually or now.
Write this code in the starting of the page.php[php]<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
?>[/php]
Mar 25 '08 #2
obj63
6
Thanks for the help, I was able to figure out what the issue was.
I do have one other question though.

So I have say page1.php that submits the underlying post to page2.php. page2.php then does what it needs to do, verifys the post submitted from page1.php and then is supposed to send a response back to page1.php.

My question now is how do I get page1.php to read and use that response? Current code is something like this -

page1.php -

[PHP]sendToHost('mydomain.com','post','/page2.php', 'code=01&param=param'');
sleep(5);
//check posted response
if($_POST['response'] != "")
{
// use the response given back and out put something
}[/PHP]

The problem is I never get the response back or the page doesn't recognize it. I did make sure that page2.php is posting back the right response by sending it to another file that outputs it to a text file so I know I am getting something back I just can't read it.

Any ideas on how to work around this?

Thanks again
Mar 27 '08 #3
hsriat
1,654 Expert 1GB
Is this a web project? :-?

In this way, page1.php will never get response from page2.php. (according to me)
Explain in detail what you want to do.
Mar 27 '08 #4
obj63
6
The main thing that I want to do is send an internal request from one page to another. Then if that page deems everything is okay to send back to the original page so it can display a form.

The problem is I want the original communication to be internal because I am hitting different servers. So basically it is site1.com/page1.php hits site2.com/page2.php. if the response is good from site2.com/page2.php, site1.com/page1.php needs to do something. Basically I am also trying to keep it all in the same browser session, etc. So really what I need to know how to do is once I sent the response to site2.com/page2.php - how can I get it to send something back so the original user experience can get that response internally and use it.

If this doesn't make sense just let me know. Also if you can think of a better way of doing this with out page redirects and user input just let me know.
Mar 27 '08 #5
hsriat
1,654 Expert 1GB
Ok, now I got it.
Don't use sendTohost(). With that the response won't be sent back to the same script (the one which was being executed), but will call same script again.

Use cURL

Regards,
Harpreet
Mar 27 '08 #6
obj63
6
Thanks again for the quick replies.
I'll do some research with that and let you know how it all works.

Joe
Mar 27 '08 #7

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

Similar topics

1
by: Pete Mahoney | last post by:
Ok I use a textarea to store data input by the user, and then upon them clicking the submit button I store this data to a database. The problem is once the user inputs too much data (about 3...
15
by: wk6pack | last post by:
Hi, I have a problem and not quite how to go about solving it. I have a form written in asp. I wish to submit the form and have the server return back to the same page without actually...
8
by: Matt | last post by:
I want to submit the form to the server without opening another page. When we do the following, it will submit the form data in myform to the IIS, and open page2.asp. <form name="myform"...
32
by: Eli | last post by:
How can I POST a form into a new window where I control the size and other attributes of the new window? Also. Are there any implications, perhaps due to browser security (Interne Explorer?)...
2
by: google | last post by:
My login.htm takes the value (a password) of a textfield and POSTS it to page2.php. This works correctly. The first thing Page2.php does is start a session, put the password in it, then open a...
3
by: Raja Balaji R | last post by:
hi I have a page1.aspx which accepts Username, Password which is posted to page2.aspx using a submit button, i want page2.aspx to submit, transfer or redirect the same posted information which...
13
by: Ian.Suttle | last post by:
I am have been researching this issue to no end, so any help would be very much appreciated. I have a page with form tags. Inside of the form tags is a panel that contains a user control. The...
9
by: Denise | last post by:
I have posted a similar message in 2 other forums but got no response. I have spent more hours than I can count researching this. Can anyone provide some insight...? Our ASP.Net application...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.