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
6 2727
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]
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¶m=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
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.
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.
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
Thanks again for the quick replies.
I'll do some research with that and let you know how it all works.
Joe
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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"...
|
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?)...
|
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...
|
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...
|
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...
|
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...
|
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....
|
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...
|
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...
|
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...
|
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,...
|
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$) {
}
...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |