Jump to content

Search the Community

Showing results for tags 'yaml'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello! I know this seems like an easy task, using strval or casting to string, but the API I am using WON'T accept anything but a hard coded string "". I figure there has to be a way to get around this... What I have here is a method used to convert an array in to a YAML/String format for me to upload onto a server using JSONAPI, found here. I am using Spyc, as that is the only thing I have found that works for this, and it does pretty well. function pushArrayToServer($array, $api) { $yaml = Spyc::YAMLDump($array,4,60); $value = 0; while (strpos($yaml, "$value:") !== false) { $yaml = str_replace("$value:", "-", $yaml); $value = $value + 1; } $yaml = str_replace("---", "", $yaml); // Final YAML from Array var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", $yaml))); } Now the problem is that last $api->call I do. This call accepts the method type as a string(argument 1), and an array for argument two. For the method "files.write", the api requires an array being (file location, string). The string is what will be replacing the content of the file. But the only way I can get that line to work is if I do this: var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", "a string here"))); That works 100% fine, no errors. This is the dump I get when I run that. But as soon as I do one of these: var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", $yaml))); $yaml2 = $yaml . ""; var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", $yaml2))); var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", strval($yaml)))); var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", "$yaml2"))); var_dump($api->call("files.write", array("plugins/GroupManager/worlds/world/groups.yml", (string)$yaml))); These do not work. The dumps all return null. I haven't found a way yet to not do "". It almost worked once when I attempted some things, but I found out I was just converting a boolean into a string which caused an error. The server I am working with is a minecraft server with JSONAPi installed. It works great, except for this error. So I am assuming the string type has to be just like Java's, or pretty plain? I have no clue this is the first real issue I've had with this plugin. Thanks in advance, HeyAwesomePeople
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.