wrapper does not support writeable connections...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
1veedo
Forum Commoner
Posts: 31
Joined: Thu Feb 19, 2004 3:59 pm
Location: With my computer wherever that may be.
Contact:

wrapper does not support writeable connections...

Post by 1veedo »

Real simple source. It's chmod'ed and everything. Just gives my this error:

Code: Select all

Warning: fopen(http://mwbg.1veedo.com/users/.data.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/x1veedo/public_html/mwbg/newUser.php on line 4

Code: Select all

<?php
$sn = $_POST['sn'];

$handle = fopen("http://mwbg.1veedo.com/users/".$sn.".data.txt", "w");
$data = $_SERVER['REMOTE_ADDR']."    ".$_SERVER['HTTP_USER_AGENT'];  //just thought I'd try this, I wont use it for anythnig.  Heard people talking about loging IPs for users.. I figure this is how you do it
fwrite($handle, $data);
fclose($handle);

$handle2 = fopen("http://mwbg.1veedo.com/users/".$sn.".login.txt", "w");
$p = $_POST['password'];
fwrite($handle2, $p);
fclose($handle2);

$heath = 10;
$level = 1;
$exp = 0;

if($_POST['PlayerType'] == 1) //attack
{
	$speed = 3;
	$attack = 6;
	$defense = 2;
}
if($_POST['PlayerType'] == 2)
{
	$attack = 4;
	$defense = 3;
	$speed = 4;
}
if($_POST['PlayerType'] == 3) //defense
{
	$speed = 3;
	$attack = 2;
	$defense = 6;
}
if($_POST['PlayerType'] == 4) //speed
{
	$speed = 5;
	$attack = 4;
	$defense = 2;
}

$handleH = fopen("http://mwbg.1veedo.com/users/".$sn.".stat.h.txt", "w");
$handleL = fopen("http://mwbg.1veedo.com/users/".$sn.".stat.l.txt", "w");
$handleX = fopen("http://mwbg.1veedo.com/users/".$sn.".stat.x.txt", "w");
$handleS = fopen("http://mwbg.1veedo.com/users/".$sn.".stat.s.txt", "w");
$handleA = fopen("http://mwbg.1veedo.com/users/".$sn.".stat.a.txt", "w");
$handleD = fopen("http://mwbg.1veedo.com/users/".$sn.".stat.d.txt", "w");
fwrite($handleH, $heath);
fwrite($handleL, $level);
fwrite($handleX, $exp);
fwrite($handleS, $speed);
fwrite($handleA, $attack);
fwrite($handleD, $defense);
fclose($handleH);
fclose($handleL);
fclose($handleX);
fclose($handleS);
fclose($handleA);
fclose($handleD);
?>
I dont have the slightest clue.
http://mwbg.1veedo.com/signup.php

The rest of the game isn't written yet, just thought I'd get registration out of the way.
1veedo
Forum Commoner
Posts: 31
Joined: Thu Feb 19, 2004 3:59 pm
Location: With my computer wherever that may be.
Contact:

Post by 1veedo »

I asked the support for my server sense three people seemed to think it was the server.. they told my to use a direct path ;)
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Yah, it's a setting in the php.ini that can be tweaked to make this work.

http://www.php.net/manual/en/ref.filesy ... -url-fopen

But this is for reading files. (Added after looking at the posts abit more...)

Glad it worked out.
Last edited by JAM on Sun Apr 18, 2004 3:06 am, edited 1 time in total.
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

You cannot write to file opened by a basic HTTP request. If that were the case you could just go around writing files on any server you wished.

As the files you want to write to are on the same server, try referencing the file using the filesystem path, I have no idea as to your paths but perhaps instead of...

Code: Select all

$handle = fopen("http://mwbg.1veedo.com/users/".$sn.".data.txt", "w");
try.....

Code: Select all

$handle = fopen($sn.".data.txt", "w");
This will be the case for all your other fopen calls
1veedo
Forum Commoner
Posts: 31
Joined: Thu Feb 19, 2004 3:59 pm
Location: With my computer wherever that may be.
Contact:

Post by 1veedo »

that's exactly what they told me to do redmonkey ;)

JAM, it's not my server :lol:
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

1veedo wrote: that's exactly what they told me to do redmonkey ;)
And I assume it works okay?
1veedo
Forum Commoner
Posts: 31
Joined: Thu Feb 19, 2004 3:59 pm
Location: With my computer wherever that may be.
Contact:

Post by 1veedo »

yep :wink:
Post Reply