Search code examples
phpvb.netwebserver

Create a user defined dir on php via .net


I've been searching for this for a while and am unsure of where to look. So what i want is for me to be able to create a user-defined folder name on my web-server via a php script. Currently i have a simple code to create a folder and name it what i want:

<?php
mkdir("a folder name");
?>

However i would like to manually choose the folder name in textbox1.text then that folder will be created on the server. Here is the code to execute a php script in vb.net:

 Dim WReq As System.Net.WebRequest =
        System.Net.WebRequest.Create("http://www.yoursite.com/script.php")
        Dim WRes As System.Net.WebResponse = WReq.GetResponse()
        System.Windows.Forms.MessageBox.Show(WRes.Headers.ToString(), "Response ", MessageBoxButtons.OK, MessageBoxIcon.Information)

I was thinking about using ftp but i cannot find a way to make a secure connection; since it send the credentials in clear text so I've scrapped that idea.


Solution

  • You can just add ?folderName=someFolderName to the end your request URL such as:

    System.Net.WebRequest.Create("http://www.yoursite.com/script.php?folderName=someFolderName")

    and then catch it on the server with PHP's $_GET function:

    http://php.net/manual/en/reserved.variables.get.php