POLALA.COM
welcome to my space
X
Welcome to:polala.com
Search:  
 HOME   Script required for writing pure binary in PHP

Script required for writing pure binary in PHP

Published by: anonym 2010-03-16

  • I'm an experienced programmer but relative beginner to PHP and am struggling to write binary data to a file in PHP - I've looked at the Coggeshall guide but I'm still struggling. Could someone please write a PHP function called WriteToBinary here where for instance I would pass it the hexadecimal values only in s string as follows $output_file == 'C:temp.txt'; $input_string == '5A0010D3A8C6000000D9C5E2D6E4D9C3C5'; WriteToBinary($input_string,$output_file); Where each set of two characters is one byte in the binary file This function would write this record to a binary file (you can assume it will be CRLF delimited records but preferably I'd like to be able to amend this so assign this delimiter as an amendable constant) Equally if this isn't possible in PHP then let me know. The answer would need to be heavily commented and self documenting so that an idiot like myself can understand it. Thanks very much in advance.


  • Thank you very very much for the comments - most helpful - I'll look into these. However I may be wasn't clear that my answer needs to be a class / function which I can call with my string. I'll tip heavily for a good answer - I prefer to do it this way in case I get an answer which isn't really suitable.


  • Check out this: http://us4.php.net/manual/en/function.fwrite.php There are nice comments how to send binaries to files or MySQL.


  • I never get this right. $somecontent = $arg1; should be $somecontent = $arg_1; Sorry about that.


  • crythias-ga, Thank you very much for your comments - I knew how to write files before, I just wanted to write the binary. I had got this far already with the comments about the pack() command which I didn't know already done - but it's not quite there and sicne you're not a GA researcher you can't place this as an answer apparently. It would need to create the file first time through - so the is_writable check is no good - and I didn't want the echo's - I just wanted to create the file write the first record and then append as I went along in the script. I can now work it out now though - so as requested I'll cancel this question.
  • Advanced Rss To Html Script Released::
    Oct 10, 2006 A new add on php script, rss2html pro not only dynamically converts rss and because the resulting page is pure HTML, it will be in a format the RSS feeds in realtime, so no periodic maintenance is required. Lady Sybilla Apologizes to Stephenie Meyer for Writing Russet Noon - 1645 views
    http://www.prlog.org/10002207-advanced-rss-to-html-script-released.html
    HOME
    OPSAT.Net - bob's Blog - Developing PHP-GTK Applications on Linux::
    May 20, 2007 In KateOS all the required files exist inside the main binary packages, we define the application 'binary' as the primary script that launches Pure PHP libraries may ''not'' be placed in /usr/lib because the GNU
    http://www.opsat.net/user/bob/kateos-phpgtk-dev
    HOME


  • ok, I guess this is still needing to be answered, or else you would have cancelled this, or you're ignoring it... From this page http://www.php.net/manual/en/language.functions.php we copy the example, change the word foo to the word WriteToBinary. Reduce the argument list to two arguments, clear the echo and return lines and paste the example from the above link inside the function, trimming the second example of . Thus, the combined function and binary write is: This very much will be the answer you requested, exactly. I am not a Google Answers Researcher. If you feel this has answered your question, please cancel/expire it. If you need clarification, go ahead and ask, but the documentation for either "function" or "write" has been very nicely detailed at the given links. The content is copied under the terms of the : 1997 - 2004 by the PHP Documentation Group. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). http://www.php.net/manual/en/.php


  • OK, Shall we try one last time? Using examples in comments at http://www.php.net/manual/en/function.bin2hex.php and http://us2.php.net/manual/en/function.pack.php and above code:





  • Where's The Advantage In Windows Genuine Advantage?
    Stocks Bounce After S&P Joins Bear Market

    You are looking at:polala.com's Script required for writing pure binary in PHP, click polala.com to home
    #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Script required for writing pure binary in PHP , Please add it free.
  • where can i get the promise ring that the jonas brothers and selena gomez have
  • my dog was just diagnosed with pancreatitis need support also what causes it
  • my puppy just got spayed
  • when is the jonas brothers concert starting
  • where can i find a cheap harmonica
  • at what age will the jonas brothers come out
  • were the new kids on the block the jonas brothers of their day
  • did the media by that nancy regan broke her pelvis by falling on the ground and not my
  • poll are you going to have a christmas tree this year
  • what does it take to be a fire fighter
  • i dont know what to do
  • should i get a dog even though i have cats
  • which one is your favorite family guy character
  • jonas brothers
  • i need more songs like this
  • which jonas brothers songs does joe sing completely or mostly
  • jonas brothers help …
  • is it true that the jonas brothers are racist toward black people
  • im like so stuck can you help
  • what is something original for me to write on a poster for the jonas brothers
  • who is dj shadow did he do collaboration with chinese filmaker
  • when will the jonas brothers voices going to break now really
  • hannah montana and miley cyrus
  • are you wearing a rock t shirt
  • help how to stop feeling uncomfortable anxious frustrated and nervous in new places around new people
  • should i believe my gf when she says she only kissed another guy
  • shampoo recommendations for a very itchy dog
  •  Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 polala.com        Site made:CFZ