/    Sign up×
Community /Pin to ProfileBookmark

Submit form into remote file

I wish to submit form on my server, to save submited info into file that is on another server, but I haven’t managed to do it. I get “Unable to open remote file for writing”….
This is what I tryed:

[code=php]
$file = fopen (“ftp://user:[email protected]/output.txt”, “a+”);
if (!$file) {
echo “<p>Unable to open remote file for writing.n”;
exit;
}
fputs ($file, “Name: $namern”);
fputs ($file, “Surname: $surnamern”);
fputs ($file, “———————————–rn”);
fclose ($file);
[/code]

I also CHMODED output.txt into 777 just to be on safe side.. But I still get error message..
And I also tryed:
$file = fopen (“http://mysite.com/output.txt“, “a+”);
but same thing…

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsMay 18.2004 — i think (not absolutely sure) you can only read files from a different server
Copy linkTweet thisAlerts:
@ExtremeauthorMay 18.2004 — Then all example in PHP help(about fopen()) are not valid!?!?

ANyway, if my approach is bad, maybe there is a another way of appending form data to remote text file?
Copy linkTweet thisAlerts:
@ShrineDesignsMay 18.2004 — [b]PHP Manual[/b] --> [i]You can also write to files on an FTP server (provided that you have connected as a user with the correct access rights). You can only create new files using this method; if you try to overwrite a file that already exists, the fopen() call will fail.[/i]

to me this would be useless in any practical application
×

Success!

Help @Extreme spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...