$the_story .= '\"I know, \" said ' . $name2 . '. \"Why don\'t we just jam this ' . $ammo . ' in it?\"\n'; $the_story .= '\"Good idea!\" agreed ' . $name1 . ', so they did.'; $the_story .= '\n\n'; $the_story .= 'And it worked! The ship was good as new. '; $the_story .= 'They agreed that the ship was awesome and decided to cruise around in it happily ever after.'; } $story_response->set_story($the_story); } //respond to client $serialized_string = $story_response->SerializeToString(); print($serialized_string); */ require_once './pb_proto_Kroto.php'; $quest01 = new Quest(); $quest01->set_questname('wadehell...'); $kroto01 = new Kroto(); $kroto01->set_id(1); $kroto01->set_name('Ngarso'); $kroto01->set_quest($quest01); $serialized_string = $kroto01->SerializeToString(); $text = print_r($serialized_string, true); $filename = 'test.txt'; $somecontent = $text; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!($handle = fopen($filename, 'a'))) { echo "Cannot open file ({$filename})";