Is it possible to open a remote file using (file or fopen or whatever) and post data to that file/page?
I want to emulate a form being submitted with some variables to another page but don't know if it is possible?
Cheers
Chris
bcolflesh
3:07 pm on Aug 6, 2003 (gmt 0)
If that remote script and file are chmoded 777.
planbeta
3:10 pm on Aug 6, 2003 (gmt 0)
Unfortunately not :( Bummer.
bcolflesh
3:19 pm on Aug 6, 2003 (gmt 0)
Maybe I read your question too quickly - If you just want to POST to some remote page, that's not a problem - put the script on your site & make the target the remote page.
Keep in mind that some guys are going to have their forms validate the referrer, so your POST data may be rejected.
vincevincevince
4:37 pm on Aug 6, 2003 (gmt 0)
if your POST is rejected, then use cURL
panic
5:15 pm on Aug 6, 2003 (gmt 0)
Well, it depends on what you mean by "opening" a remote file.
If you just want to read it, then yes, it's possible.
If you want to create/edit/etc remote file, you might want to consider pushing variables to a remote PHP or Perl script which then creates/edits/etc the desired file or files.
-panic
planbeta
7:32 pm on Aug 6, 2003 (gmt 0)
Exactly what I am doing is, posting a variable (a keyword) to a search, then I want to grab this search page results and display them in the script page...if that makes sense?
Cheers
Chris
panic
8:36 pm on Aug 6, 2003 (gmt 0)
Are you saying you want to use results from an existing search engine (such as Google)?
-panic
planbeta
8:50 pm on Aug 6, 2003 (gmt 0)
Yes but not from an search engine, same principle though.
panic
10:50 pm on Aug 6, 2003 (gmt 0)
Use this :
$file = file("http://domain.com");
foreach($file as $line){ //do whatever it is that you need to do to the data here }