Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
  • play and control volume of audio files in iPhone (In: I Want to Sell My Website)
  • php update question (In: Coding & Databases - PHP, ASP, Perl, etc.)
  • Multimedia files (In: Domains, Hosting, DNS and Server Issues)
  • Featured Web Site Template

    Hundreds More at Free Site Templates.com!

    Web Site Partners
    Sponsored Links
    Jet City Software
     
    Whos Here ?
    Reflects user activity within the last 5 minutes
    Moderator(s): Prowler, jcokos
    Member Message

    yoogi
    Joined: Apr 11, 2004
    # Posts: 63

    View the profile for yoogi Send yoogi a private message

    Posted: 2005-Jul-12 05:34
    Edit Message Delete Message Reply to this message

    Hello,
    I want to use PHP to output binary files,
    I am making a crossword applet which reads a binary file.
    I want it to read mysite.com/todayspuzzle.php instead of binary file, and the todayspuzzle.php should return the binary file for the day.

    Is that possible, and how do i do that?

    Thanks in advance



    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jul-12 06:40
    Edit Message Delete Message Reply to this message

    Anything is possible, however I'd say the use of the term 'I'm making a...' isn't quite correct here, sounds more like you have an idea for this, but that's about it.

    You have to give details when you ask programming questions. What type of binary file for instance? It also helps to pinpoint the question further, for example what have you tried so far, and which areas did you run into problems with?




    yoogi
    Joined: Apr 11, 2004
    # Posts: 63

    View the profile for yoogi Send yoogi a private message

    Posted: 2005-Jul-12 19:09
    Edit Message Delete Message Reply to this message

    I have an applet that runs fine from my server. It loads a binary file, saved as .xsum (cross sum puzzle) on my server . The file name is configured by Applet PARAMs. The applet code can be pasted into any webpage, and the applet works fine.

    Ok, now I need it to show diffrent puzzle everyday. I can change the parameter value via applet, but if other webmasters are intrested in showing the applet in their site, they will also need to change the parameter value.

    So I dont want to change the file name, but I want to
    change the content of the file.

    So I want to fix the file name to
    http://mysitedotcom/todayspuzzle.php

    and I want
    todayspuzzle.php to produce the binary file as is.
    Is that possible? How do I write the PHP code?

    I can map the day to a physical file name on the server.

    <?

    $fileName = date( "y" ) . "_" . date( "m" ) . "_" . date( "d" ) . "xsum";

    // Now I need to read the whole file (around 1-3 KB) and
    //then send it to output, just as if the URL is the $fileName
    // But how do i do that?


    ?>




    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jul-13 09:22
    Edit Message Delete Message Reply to this message

    "just as if the URL is the $fileName"

    Just echo $fileName in the applet code you paste into webpage, if I understand you right.

    Since it's your applet that's producing the binary code, that doesn't have anything to do with php from what you say, all you would use php for is to echo out whatever filename or parameter you want to use, which would then create the puzzle. At least that's what it sounds like to me from what you said. If all you need to do is echo some string into the applet code you paste on the page, that's pretty trivial. If you need something more, you probably need to learn a lot more about php before going on. If you need to learn how to echo a string with php, you also should probably spend some time learning php basics, since that's about as basic as it gets <applet src="<?php echo 'hello_world.file'; ?>"> or whatever.



    yoogi
    Joined: Apr 11, 2004
    # Posts: 63

    View the profile for yoogi Send yoogi a private message

    Posted: 2005-Jul-13 19:22
    Edit Message Delete Message Reply to this message

    Hello lizard, Thanks for your tips. But that does not fit my purpose IMHO.

    #1.If Other webmasters are intrested in showing the applet in their site, I am going to allow them. So using php to change the file name parameter is out-of question. It wont be a nice idea to restrcit the usage to just php only web-pages.

    #2. "Since it's your applet that's producing the binary code"
    Sorry if I have not made it clear. The Applet does not produce the binary file. The applet reads from the source binary file.





    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jul-13 19:54
    Edit Message Delete Message Reply to this message

    "I am going to allow them. So using php to change the file name parameter is out-of question. It wont be a nice idea to restrcit the usage to just php only web-pages."

    You're posting your question in a php forum, you want to use php to do something. Now you don't want it to do something. Makes no sense to me. You're either using php in your solution, which restricts it to php supporting pages, or you're not. You'll have to make up your mind at some point what you want or you'll never get your thing running.

    I'd step back from this and try to decide what it is you're actually trying to accomplish, and what you want to support or not support. Once you can actually put into very clear, precise terms what the project requirements are, I think you'll find that the solution becomes much more obvious.

    Good luck.



    yoogi
    Joined: Apr 11, 2004
    # Posts: 63

    View the profile for yoogi Send yoogi a private message

    Posted: 2005-Jul-14 03:53
    Edit Message Delete Message Reply to this message

    Lizard,

    <img border="0" src="http://fastcounter.linkexchange.com/fastcounter?592983+1185973"></a>

    Please see that this is a hit-counter image source code, written in plain html on a server that cannot run any script. The src value is not an image, but a script. But linkexchange. com can run the script, and supply the image to the visitor.

    Just like how

    "http://fastcounter.linkexchange.com/fastcounter?592983+1185973"

    this reurns an image, I want my url to return a binary file.

    This is atleast a liitle bit complicated than just echoing a string. If you dont understand the problem, just say so. I really tried to be polite with my previous post. You are irritating me!. You mis-understood the problem and blame me for not being clear in my requirement. You read all the wordings of my previous posts ,

    I have made it very clear that

    1) the php has to be on my server
    2) the pages that runs the applet does not have to run php script
    3) I dont want to change the src filed. But the content of it,



    Please dont mislead others into thinking that this is a Non-sense problem.

    I dont know how I can make the problem more clear than this.








    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jul-14 05:50
    Edit Message Delete Message Reply to this message

    "I dont know how I can make the problem more clear than this."

    You need to be at least this clear in order for anyone else to understand your question. Am I correct in assuming that english is not your first language? When somebody doesn't understand what you say, it's often because you're not being adequately clear in what you are saying. You can get annoyed about this, but it doesn't do any good, you're still not being understood. It's better to figure out a way, like you did, to make yourself clear.

    If you're in doubt, post the actual code that calls the binary on the remote sites. It is always better to post code than to ask general questions that may or may not be understandable to others. No code = random guesses as to what you are asking.

    I think I actually figured out what you want, is this right: you want a php script, which you currently have not written, to return a binary file using some type of parameter you pass it through a query string, I assume that's how you'd pass it, can't think of anything else. This parameter would then allow the php script to return the correct binary file from a folder on your server.

    For instance, just a guess:
    <img src="h**p://yoursite.com/binary_file_upload.php?type=daily">

    This is pretty easy to do with standard mimetypes like jpg, pdf, doc etc, but with an unknown mimetype it might create issues is my guess, that would be more on the browser side of things than the php side, although I'm not sure about that.

    If on the other hand you're using an actual <applet> or <object> type tag to load the file on the remote sites, and want to use their parameter values to trigger which binary the php file returns, that won't work I think. Note here that no one reading this thread could possibly know how you are actually doing this since you still haven't posted a code sample that would show it clearly.

    Look into the php header() material, I'm not sure the standard methods will work for a non standard binary format, they might, they might not, hard to say without trying.

    Anyway, good luck on figuring out your problem.

    [ Message was edited by: lizardz 07/13/2005 10:23 pm ]





    yoogi
    Joined: Apr 11, 2004
    # Posts: 63

    View the profile for yoogi Send yoogi a private message

    Posted: 2005-Jul-14 16:51
    Edit Message Delete Message Reply to this message

    Hello Lizard,

    Thats right. You hit the nail on its head.I am not a native english speaker.

    There is some ambiguity in the way I stated the problem, I agree.
    "It loads a binary file, saved as .xsum (cross sum puzzle) on my server " made you believe that I am looking to up-load a file to my server, which I cleared up with due apologies in the next post.

    But when i say "changing the file name using php is out-of question, to enable other non-php websites to use the applet" - I am just making the specification more clear. I am not shutting out other ways in which php can solve the problem. How it leads you ( A native speaker of english and php expert IMHO) to think that I dont want php at all?

    Also I have provided part of the php, and placed a more specific question inside the source, as comments.

    <?

    $fileName = date( "y" ) . "_" . date( "m" ) . "_" . date( "d" ) . "xsum";

    // Now I need to read the whole file (around 1-3 KB) and
    //then send it to output, just as if the URL is the $fileName
    // But how do i do that?

    ?>

    The solution is,

    <?
    $fileName = date( "y" ) . "_" . date( "m" ) . "_" . date( "d" ) . "xsum";

    $headerCode = "Location: " . $url . $filename;
    Header( "$headerCode" ) ;

    ?>

    Lizard, I would appriciate immensely if you can teach me, How I can rephrase the problem so that it becomes more clear.



    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jul-14 18:48
    Edit Message Delete Message Reply to this message

    Is your solution working? In other words, is the browser visiting the remote site running the applet code correctly receiving and downloading the binary on the user's browser, MSIE, Firefox, Opera?

    The best way to remove doubt about what you are asking is to post all the relevant code, HTML and PHP.

    It's the remote site applet code I'm interesting in seeing, is it <applet>, <img...>, or <object>? In general, if you post the relevant code, which in this case is the applet code on the remote websites, it's easier to visualize the problem. The reason it was hard for me to understand what the project is is because it sounded like the applet was running on the remote sites, then it sounded like the applet was running through php. If you just post an examplified version of your applet code [using mysite.com instead of your real domain name] it's much easier to see what you need.

    However, to me it sounds like what you need is to simply give the remote user an option of query string parameters to add to the primary binary file request. Those parameters will determine which file is returned to the remote site. This query string data would then be used by the php script to determine which binary file to return to the remote site.

    Where are you from?


    [ Message was edited by: lizardz 07/14/2005 11:27 am ]





    yoogi
    Joined: Apr 11, 2004
    # Posts: 63

    View the profile for yoogi Send yoogi a private message

    Posted: 2005-Jul-15 19:14
    Edit Message Delete Message Reply to this message

    lizardz,

    in your solution, Posted: 07/13/2005 01:22 am

    If you need to learn how to echo a string with php, you also should probably spend some time learning php basics, since that's about as basic as it gets <applet src="<?php echo 'hello_world.file'; ?>"> or whatever.


    #1. did you read the part of the sample piece of php code I have written, it ends as .xum, I am also talking about files saved as .xsum. How that would be in a <applet src=?>

    #2. I am talking about changing a PARAM value, not src value
    In india, something like this is called param.
    <PARAM NAME="FILENAME" VALUE="http://fileurl">
    and we say src as attribute of applet tag.


    "You're posting your question in a php forum, you want to use php to do something. Now you don't want it to do something. Makes no sense to me. You're either using php in your solution, which restricts it to php supporting pages, or you're not. You'll have to make up your mind at some point what you want or you'll never get your thing running. "


    As I have already said, I had a clear question inside the php comments, and also would like to remind you that just because php cannot be used in one place does not exclude the usage in other places. How quickly you jumped into conclusions to advice me to "make up my mind as to what I want to do?". Should I also jump to the conclusion that you are not trying to find any other solution than the first one that occurs to you?


    "However, to me it sounds like what you need is to simply give the remote user an option of query string parameters to add to the primary binary file request. Those parameters will determine........."


    why are you bragging about query strings of the ? A daily cross-word applet needs to know only the date and nothing else to choose the appropriate crossword file.Put a full-stop to your imaginations and visualisation. What am I supposed to use in native english? DAILY CROSSWORD APPLET, Mapping date to a file on the server, what is that I am missing that confuses you? I think b'cos you saw the hit counter login number as a parameter, and think my solution also should have a paramenter, whether there is a reason or not.

    Finally,

    The full applet-tag source code is available here

    http:// www . winpcware . com / xsum-applet . html

    Please strip the unwanted white-spaces to get the correct url. The Solution / php code is already posted here.

    This works on IE 6.0.28** and Fire fox 1.0.4.



    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jul-15 19:41
    Edit Message Delete Message Reply to this message

    OK yoogi, I give up, for some reason you just don't seem to understand what I'm saying to you. I've asked you repeatedly to post your applet code, what is pasted on the webpage, but you go rambling off about this and that, post meaningless examples that are then not relevant to your thing. If you want help, post your code, is there something unclear about that? If so, what? Is it the word 'post' or is it the word 'code' that you are having problems with? Or is it how they work together? Post is the verb, code is the noun. You've posted a partial php sample, that's all. I give up. You keep talking words about code, then you post a link finally to your code, assuming I really care enough to spend time doing something you should have done on your first post, namely posting the relevant code.

    Your english is just not working for you, either in terms of reading or writing. I'm not 'bragging' about anything, don't get mad at someone who can't quite get what you are saying when your english just isn't quite up to doing what you want it to do.

    Sorry, I can't spend any more time on you. It was sort of any interesting problem though.



    g1smd
    Staff
    Joined: Jul 28, 2002
    # Posts: 10465

    View the profile for g1smd Send g1smd a private message

    Posted: 2005-Jul-15 20:02
    Edit Message Delete Message Reply to this message


    Time for everyone to calm down, cool off, and leave this thread alone for a day or two.


    You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
    1. You have not yet logged in, or registered properly as a member
    2. You are a member, but no longer have posting rights.
    3. This is a private forum, for which you do not have permissions.

    If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

    If you cannot find this message, click here to Re-Send it.

    If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

    Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

    New posts Forum is locked
    © 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions