File streaming in PHP - How to replicate this C#.net code in PHP? -


I am writing an interface for a web service where we have to upload the configuration files. The documentation provides a sample only in C # .net which I am not familiar with. I am trying to implement it in PHP.

Can anyone be familiar with both languages, indicates me in the right direction? I can understand all the basic things, but I am trying to remove the appropriate PHP substitutions for the FileStream, ReadBytes, and the UploadDataFile function. I believe that RecService is the URL for web service in the object. Thanks for your help!

  Private Zero Uploadfile () {clientAlias ​​= "& lt; yourClientAlias ​​& gt;"; String filePath = "& lt; pathToYourDataFiles & gt;"; String [] fileList = {"Config.txt", "ProductDetails.txt", "BrandNames.txt", "CategoryNames.txt", "ProductsSoldOut.txt", "Sales.txt"}; Recommended Client Rick Service = New Recommended (); (Int i = 0; i & lt; fileList.Length; i ++) for {bool lastFile = (i == filelist. Length - 1); // start generator after the last file {string fileName = filePath + fileList [i]; If (! File example (filename)) release; // file not found} // Set a file stream and binary reader for the selected file and convert the byte array to FileStream fstream = new FileStream (fileName, FileMode.Open, FileAccess.Read); Binaryreader BR = New Binary Reader (Fstream); Byte [] data = br.ReadBytes ((int) numBytes); Br.Close (); // Web service string result = RecService.UploadDataFile (clientAlias, fileList [i], data, lastFile) pass-byte array; FStream.Close (); Fstream.Dispose (); } Hold (exception before) {// an error message log}}}  

For reading the files on the local system and remotely on HTTP, you can use.

To post a web service, you should probably use how it looks like a very good explanation about how to go about it.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -