Re: write with cURL



Tim Greer wrote:
user@xxxxxxxxxxxxxx wrote:

Hi,

I want do create a new file and write something in it like:

$file = fopen("test.txt","w");
fwrite($file,"Hello World. Testing!");
fclose($file);

My provider doesn't allow this action for security reasons. However
they mention using cURL to do the same thing.

I have been searching the Internet to find out how to do this, but did
not find the answer. A did find a lot of answers to others questions,
but not this one. ;-))

So any help is appreciated very much.

Cheers,

Ylva

If your host says they deny opening and writing to a local file because
it's insecure, then it's time you find a new host that knows what they
are doing. There's not much point to hosting on someone that offers
PHP, if they don't allow PHP to open (or create) and write to files. Are you sure there's not some other specific issue of why it's failing? How exactly is is failing? I don't see the reason for them to mention
Curl as a replacement method for your task (that doesn't make sense). Perhaps it's a permissions/ownership issue, or you're trying to open a
file over FTP/http or something on another site or system? A lot of
people deny open for URL's, which can be a good thing, so it might
depend.


I have just this little script:
<?php
$file = fopen("test.txt","w");
fwrite($file,"Hello World. Testing!");
fclose($file);
?>

nothing else
.



Relevant Pages

  • Re: HELP: strange php behavior downloading html
    ... problem in less than an hour, using cURL with PHP. ... Here is the function I wrote to download a uri into a file (following ... all redirects, ignoring old cookies, and passing set cookies to redirects): ...
    (comp.lang.php)
  • Re: [PHP] PHP 5 file_get_contents() problems
    ... I created a simple set of curl functions which just printed a remote url to ... This tested well on an alternate test site which has PHP ... The given remote host was not resolved. ... So I'm lead to believe there is some other PHP configuration (or server ...
    (php.general)
  • Re: mail and displaying errors
    ... For whatever reason, it's ... my question is - how do I make php print the real ... What should I be looking at to figure out why mail is failing to ... JDS Computer Training Corp. ...
    (comp.lang.php)
  • Re: Auto submitting a form that contains a file field
    ... Client end is NOT php. ...  Thanks, - Dave ... post-file in wget or the equivalent in CURL to do the thing. ...
    (comp.lang.php)
  • Re: Extension files not loading
    ... This can also occur if one of the DLL's required by the PHP SyBase DLL ... could be that they all are failing to find external dependencies. ... perhaps it is more of an issue with how I have apache configured. ...
    (comp.lang.php)

Loading