rubing
-
Posts
366 -
Joined
-
Last visited
Never
Posts posted by rubing
-
-
Yes I meant i wanted php as the backend. Basically i need my mp3 player to query the php page, which will then return the url of the song to play.
still not sure where to get started. i am using soundmanager 2 as my mp3 player, which is a javascript interface to flash. do i have to incorporate this functionality to the player itself?
maybe i should just learn flash? can't flash query my php page directly and then play the resulting url. sorry i now realize this is not an explicit php question and maybe should've been posted in another forum.
-
Hey fellow phpers,
I am hoping someone can advise me on an application i am trying to build. Let me try explaining this as clearly as possible:
I have a page with a list of items (songs) each linked to a php page. The client requests one of these items and the php script determines the appropriate item to return (correct version of the song to play) for this user. The item is served (song is played) asynchronously.
Maybe this is something I should be doing with Flash?? or Ajax??
thanks for any advice!!!!
-
Gee, that was dumb of me. Thanks for spottin that one!
-
I am trying to code a script that stops running when there are no results found in my table. When i run this it says that the result set is 0, but it keeps executing.
$count =1; while ($count=1) { $api=mt_rand(10000000,99999999); $query="SELECT * FROM api WHERE api=".$api.""; if ($results=$conn->query($query)) { $row_cnt = $results->num_rows; printf("Result set has %d rows.\n", $row_cnt); if($row_cnt==0) { $count=0; } $results->close(); }
-
i'm not trying to hack my way to a solution. I am trying to learn something about coding php and taking advantage of its built-in functions.
Maybe, I'm not doing something right, maybe there's something that can be done with the optional flags. I don't ven know what there there for or how to set them. I find that gap in my knowledge disturbing and so am asking for help.
now, i just found out that the Validate url filter is no different than the parse_url function.
-
Why would I do that if it's built-in?
-
I need to validate a URL coming from a form (method=post), so I am using the following code:
$validurl=filter_input(INPUT_POST,'website', FILTER_VALIDATE_URL); if ($validurl ===FALSE) { throw new InvalidInputException(); }
It doesn't do as good of a job as I'd expect. (i know, i know, i could use pear RFC validation, blah blah blah...), If I pass in something like xkjvi://mymamma.comlhj , it is accepted without a problem.
the documenation says that the following optional flags:
FILTER_FLAG_PATH_REQUIRED & FILTER_FLAG_QUERY_REQUIRED
,but im not sure what they do or how i would set them, since the manual just says:
Associative array of options or bitwise disjunction of flags. If filter accepts options, flags can be provided in "flags" field of array.And I have no idea what that means
-
hey php crew,
Several months ago I was on the planet-php.net site, a great collection of php blogs (in case you didn't know). And saw a really cool php project, which was basically an alternative to a full blown LAMP, but nonetheless would interpret and let you view your php code as a web page. For the life of me I can't remember what this project was called and now I can't find it anywhere. Does anyone know what i am talking about??
-
These are all really great ways!!! thx guys.
I think the -o option on grep is what I was really after...it works fine.
-
sorry thorpe. yes i am just looking to extract the url from the line of interest. I think I can work with what you wrote here.
using sed is also seems a good idea, but would prefer quick and dirty since i've been told it has a steep learning curve.
thx all!
-
I am using grep to try and find a url in a text file. typically i only know a single pattern in the url (e.g. 'tresure.com')
So, Grep does a great job of finding the line which contains the pattern (e.g. 'come to our site: www.buried-treasure.com') However, I would like to extract/parse just the url. from this line, that grep is detecting.
-
aye aye captain!
-
OK. I'm fine with that. As long as I have someone to blame other than PHP.
-
The errors are not sent to std err for file uploading. They are contained in the array. [error]=>1
-
OK, so I changed it as follows:
ini_set ('upload_max_filesize','25M'); ini_set('post_max_size','25M');
Yet, this still doesn't work! (only on smaller files) here are the errors i get:
Array ( [uploadedfile] => Array ( [name] => 01-Kushee Maanao-Aural Mix-Solace.mp3 [type] => [tmp_name] => [error] => 1 => 0 ) )
-
I am trying to upload files to my server (shared hosting). The size limit for uploaded files is 2M (default). Well, of course I am super greedy and want to upload HUGE files!!!
so, I tried amending the max size permitted as follows:
ini_set ('upload_max_filesize','25M');
Yet this has no effect. Any suggestions?
-
I use the improved mysql functions to escape my data prior to insertion (e.g. mysqli_real_escape_string), so a subtle question arises.
Do I query as follows:
$query="SELECT cola FROM table.a WHERE colb='$var'"; $conn->query($query);
Or like this:
$var = $mysqli->real_escape_string($var); $query="SELECT cola FROM table.a WHERE colb='$var'"; $conn->query($query);
-
Ok I figured out a way to do what i wanted as follows:
$mp3string=file_get_contents($mp3,FILE_BINARY,$context=NULL,$offset=200000,470000); file_put_contents($mp3,$mp3string); [/code 1. I read the mp3 file in as a string with my desired offset 2. Save this new (truncated;offset) file.
-
OK, so I changed my code to the following:
$handle=fopen($mp3,'a'); fseek($handle,200000); ftruncate($handle,260000);
Yet this still truncates the file from the beginning till the 260000 byte. I thought specifying the file pointer with fseek would start the truncate in the middle of the file. Is there a way to do this in php without using some foreign class?
-
yes the file is at least 584000 bytes
-
The code above just gives me an empty 250k file
-
I am trying to take a file that is 600000 bytes and truncate it so that i only have the middle 250000bytes (trimming begining and end off). The following code using the ftruncate() function is not working ???
$handle=fopen($mp3,'w'); fseek($handle,200000); ftruncate($handle,250000);
-
yeah, i should've realized that...urlencode is the simplest for my app....thanks!
-
hey all,
i want to pass a url as the parameter in a $_GET variable (e.g)
http://www.example.com/pass.php?id=7&limit=1&url=http://www.doesntwork.com/howtofix.php?works=yes&lastchar=broke
These $_GET varialbles will be truncated. The variable:
http://www.doesntwork.com/howtofix.php?works=yes&lastchar=broke
has an '&' character which is interrupreted instead of being included.
Basically I am asking, how do you escape the '&' character in a GET query???
So that it's not interpretted as the end of the variable??
asynchronous php?
in PHP Coding Help
Posted
BTW: I should mention this is something I am developing as part of a webservice. So, it has to be something that other webmasters can easily include on their sites.