cancel
Showing results for 
Search instead for 
Did you mean: 

Methods permitted on CCGI?

val
Grafter
Posts: 45
Registered: ‎15-08-2007

Methods permitted on CCGI?

I'm trying to use the PUT, GET, and DELETE methods with a PHP script on the CCGI server, but not having much success. Are these methods actually permitted?
--
Regards,
Val
5 REPLIES 5
Peter_Vaughan
Grafter
Posts: 14,469
Registered: ‎30-07-2007

Re: Methods permitted on CCGI?

PUT & GET yes, never used DELETE so can't say but I see no reason why it should not work.
What is your problem with using them?
val
Grafter
Posts: 45
Registered: ‎15-08-2007

Re: Methods permitted on CCGI?

Hi Peter,
I was getting the 405 error saying PUT wasn't permitted, but I see now that it's a problem with paths, of the sort http://......./code.php/level1/level2
I've hit this problem in the past with Plusnet's server not recognising the subpaths, and had to get round it using mod_rewrite.
'Twas so long ago, that I've forgotten most of how I did it  Sad
Bit of a pain that Plusnet still hasn't allowed these subpaths on their server.
--
Regards,
Val Sharp
Marteknet
Grafter
Posts: 577
Registered: ‎13-10-2007

Re: Methods permitted on CCGI?

here is a example for you to play around with it works for me. All this does is open a dat file that contains just one number it adds one then resaves it.
<?php
$fd = fopen ("counter.dat", "rb");
while (!feof ($fd)) {
$buffer = fgets($fd, 4096);
}
fclose ($fd);
$fp = fopen('counter.dat', 'w'); // set the handle to the variable $fp
// and open the file in "w" mode.
$buffer = $buffer + 1;
flock($fp, LOCK_EX); // lock the file "exclusivley" for writing
fputs($fp, $buffer); // write the data to the file
flock($fp, LOCK_UN); // unlock the file
fclose($fp);
?>
To delete a file use something like this:
<?php
$delfile = "yourpath/yourdir/yourfile.txt";
if ($delfile !=""){
if(file_exists($delfile))
unlink($delfile);
}
?>
I hope this was of some help to you. Peter.
Peter_Vaughan
Grafter
Posts: 14,469
Registered: ‎30-07-2007

Re: Methods permitted on CCGI?

Val has the problem, not me.
Also we are talking about form submit methods in PHP not writing to or deleting files.
Marteknet
Grafter
Posts: 577
Registered: ‎13-10-2007

Re: Methods permitted on CCGI?

Quote from: Peter
we are talking about form submit methods in PHP not writing to or deleting files.

Ok. I am sorry, I didn't read the question correctly. By the way I  was addressing my post to Val, my name is also Peter.