PHP - Retrieving Shoutcast Metadata
Hi, php newbie here..
Can you explain how can i use this stuff in php? http://www.smackfu.com/stuff/programming/shoutcast.html I found a phyton script: http://jasonlebrun.info/2006/12/31/icy-metadata-shoutcast-song-titles/ and Java code (i guess): http://www.codeproject.com/KB/audio-video/SHOUTcastRipper.aspx But i didn't found any php solution for this problem anywhere Similar TutorialsHi all What I'd like todo is setup a webpage that allows access if the client's ip matches the ip currently connected to my shoutcast server, the overall goal is to upgrade our Dj Control panel so the currently on air Dj can access the stream controls and anyone else simple gets an error message saying something along the lines of ' I'm sorry - another dj is connected at the moment - please try again when you are live ' I'm guessing I need to look into php authentication and also using ip's to authenticate a user - I've been using if and else statements at the moment to authenticate users based on a user group id but want to take it a little further and add into that a new step Can anyone suggest tutorials or material that can help this goal? Or does anyone have an idea how to go about this? Much respect hi, How can I read metadata geotiff so that get information like corner coordinates and proj and GCS and datum and ... Inside one folder i have around 200 folder's and each folder's having 150 mp3 files. I want to get metadata of each mp3 file's below is the code which i have tried but getting below error. Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(C:\Users\Desktop\Rajesh song,C:\Users\Desktop\Rajesh song): The system cannot find the path specified. (code: 3)' in C:\xampp\htdocs\getID3-master\rajupal.php:4 Stack trace: #0 C:\xampp\htdocs\getID3-master\rajupal.php(4): RecursiveDirectoryIterator->__construct('C:\\Users\\Deskto...') #1 {main} thrown in C:\xampp\htdocs\getID3-master\rajupal.php on line 4 <?php include("getid3/getid3.php"); $directory = 'C:\Users\Desktop\Rajesh song'; $filename = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)); while($filename->valid()) { if (!$filename->isDot()) { $getID3 = new getID3; $file = $getID3->analyze($filename); //print_r($file); $playtime_seconds = $file['playtime_seconds']; $dumpa=gmdate("H:i:s", $playtime_seconds); $filesize = $file['filesize']; $filepath = $file['filepath']; $filename = $file['filename']; $filename1 = $file['fileformat']; echo "<table class='table table-striped'>"; echo "<tr>"; echo "<th>File Path</th>"; echo "<th>Name</th>"; echo "<th>Size(kb)</th>"; echo "<th>Duration</th>"; echo "<th>File Type</th>"; echo "</tr>"; echo "<tr>"; echo "<td> ".$filepath."</td>"; echo "<td> ".$filename."</td>"; echo "<td> ".$filesize."</td>"; echo "<td> ".$dumpa."</td>"; echo "<td> ".$filename1."</td>"; echo "</tr>"; echo "</table>"; } $filename->next(); } ?> Edited July 26, 2020 by sapnawat Finally getting around to giving Doctrine a try. Looks like YAML is depreciated, so my choices are DocBlocks or XML. I am sure it is personal choice, however, I would like to start off with what most feel is the best path. Any recommendations? Thanks ok im back quicker than i thought.... i got my drop box sorted and i got it reloading the page. so it all works correctly. but how do i get the page to display information regarding the film i have selected in the drop box.? i have no code for this at the mo. also i would like the drop box to display the selected item at top of box when it refreshes code for drop box: Code: [Select] <FORM> <?php $result = mysql_query( "SELECT * FROM movie_info ORDER BY title ASC ") ; echo "<select name= Film onChange='submit()' >film name</option>"; while ($nt=mysql_fetch_array($result)){ ?> <?php echo "<option value='$nt[id]'>$nt[title] </option>"; } ?> </select> </FORM> any help would be great i have had a difficult time trying to work this out.I need to do some pattern matching for certain urls and retrieve information from it. For example, $url=http://www.test.com/showpic.php?do=showpic&u=89165&a=34933 if $url contains the value showpic.php,then i need to retrieve the following { $u=value of u(i.e. 89165 in this case) $a=value of a(i.e. 34933 in this case) } else do nothin.. the format of the url will always be the same as above if it contains showpic.php $qID = ''; $question = 'Question not set'; $answerA = 'unchecked'; $answerB = 'unchecked'; $answerC = 'unchecked'; $answerD = 'unchecked'; $answerE = 'unchecked'; ?> <html> <head> <script type="text/javascript"> function show_alert() { alert("Please Click OK to proceed!"); } </script> </head> <form action="Process1.php" method="POST"> <table> <tr> <td> <?php $SQL = "SELECT stu_satisfaction_tblquestions.question_id, stu_satisfaction_tblquestions.question, answer_type.answer1, answer_type.answer2, answer_type.answer3, answer_type.answer4, answer_type.answer5 FROM stu_satisfaction_tblquestions INNER JOIN answer_type ON stu_satisfaction_tblquestions.answers_id=answer_type.answers_id "; $result = mysql_query($SQL); while($db_field = mysql_fetch_assoc($result)){ $qID = $db_field['question_id']; $question = $db_field['question']; $A = $db_field['answer1']; $B = $db_field['answer2']; $C = $db_field['answer3']; $D = $db_field['answer4']; $E = $db_field['answer5']; print $question; ?> </td> </tr> <tr> <td> <INPUT TYPE = 'Radio' Name ='q' value= 'A' <?PHP echo $answerA; ?>><?PHP echo $A; ?> <INPUT TYPE = "Hidden" Name = "h" VALUE = <?PHP print $qID; ?>> <?php echo $qID;?> </td> </tr> <tr> <td> <INPUT TYPE = 'Radio' Name ='q' value= 'B' <?PHP echo $answerB; ?>><?PHP echo $B; ?> <?php echo $qID;?> </tr> </td> <tr> <td> <INPUT TYPE = 'Radio' Name ='q' value= 'C' <?PHP echo $answerC; ?>><?PHP echo $C; ?> </tr> </td> <tr> <td> <INPUT TYPE = 'Radio' Name ='q' value= 'D' <?PHP echo $answerD; ?>><?PHP echo $D; ?> </tr> </td> <tr> <td> <INPUT TYPE = 'Radio' Name ='q' value= 'E' <?PHP echo $answerE; ?>><?PHP echo $E; ?> <br> <?php } mysql_close(); ?> </tr> </td> <tr> <td> Please add any comments you may have:</br> <textarea rows="3" cols="60" name="comments" id="comments"> </textarea> </td> </tr> </table> <input type="submit" onclick="show_alert()" value="Submit" /> </form> </html> I ran to some problems here. After filling every question up with the answers. When i process the form, i only managed to get QID of 20 and the answer of 1st question as my database have only 20questions. How do i go about in solving, so that i'm able to retrieve all result and update my database correctly $selected_radio = $_POST['q']; $qID = $_POST['h']; echo $selected_radio; echo $qID; $SQL = "UPDATE answers SET $selected_radio = $selected_radio + 1 WHERE question_id='$qID'"; $result = mysql_query($SQL); mysql_close(); print "Thanks for voting!"; ?> THis is my process page, and i echo out the answer to be B and qid as 20. i am trying to retrieve messages with some code. It seems to be a bit more complicated that i thought it would be. so here it goes: Code: [Select] $query = "SELECT * FROM memberMail WHERE userIDFrom='92' AND unread='1'"; $result = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result) or die(mysql_error()); $num_rows = mysql_num_rows($result); echo "You have (" . $num_rows . ") unread message(s)."; $i = 0; for($i; $i<$num_rows; ++$i) { if($row[$i[unread]] == "1") { echo $row[$i[message]] . "<p>"; } } } what i am trying to do, is print out the messages from the records that are unread, and are from a certain user. i don't think this for statement will pick up the record numbers that got matches though. and i am not entirely sure about the $row statements in the for statement either. There's many options available for downloading a URL - but I'm stuck. I've looked through all the ones I know, but none seem to pay attention to partial content. I'm trying to retrieve a URL that gives the following header: HTTP/1.1 206 Partial Content Content-Range: bytes 0-100000/631723 As you can see it dishes out the file in 100,000 byte chunks. Trouble is, when I use any method in PHP, ie file_get_contents, fopen, or even cURL, none of these continue on after retrieving the 100,000 bytes. End result, I have a 100,000 byte file. What I need is to get the PHP script to grab all the data, in the example above, all 631,723 bytes. How can I do this? Hi there I am trying to use cURL to retrieve XML from a gateway. The code I am using works (ie. returns the HTTP response) for any URL that I use except the one that I need! The URL is below, and when using that I get a blank response every time. I've tested and can telnet to that IP address on that port from my server. I'm not sure if it is because of the format/structure of the URL? Could it have something to do with the port of the gateway? Any assistance would be much appreciated. http://196.11.120.190:8080/mtnusa/client.jsp?command=<usareq NODE="tHTTP" USERNAME="HTTP" PASSWORD="1234" TRANSFORM="SMPP"><command><submit_sm><a_number>278200703520709</a_number><b_number>27824411926</b_number><service_type/><message>Test</message><registered_delivery/></submit_sm></command></usareq> The function I am using (from http://davidwalsh.name) is: /* gets the data from a URL */ function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } $returned_content = get_data('http://196.11.120.190:8080/mtnusa/client.jsp?command=<usareq NODE="HTTP" USERNAME="HTTP" PASSWORD="1234" TRANSFORM="SMPP"><command><submit_sm><a_number>278200703520709</a_number><b_number>27824411926</b_number><service_type/><message>Test</message><registered_delivery/></submit_sm></command></usareq>'); I'm making a game I have finished but have spent days and still can't figure out this part or how it should be done: Gamer will type in keyword on the form box on my page then click submit the page will connect to yahoo search then save/put the address bar URL search result of the keywords into a variable onto my page but the gamer will never have his page directed to yahoo but continue staying on my page while this all happens. Any Help in the right direction or some code would be appreciated? Hi, so i have a problem. I'm using a script to enable and disable checkboxes, and i'm id-ing them fetching values from a database: while($data = mysqli_fetch_array($sql)) { if ($count % 5 == 0) { echo '</tr><tr>'; $count = 0; } echo '<td><input name="subject_level[]" class="subject_a" disabled="disabled" type="checkbox" id="subject_level_'.$data['subject_level_id'].'" value="'.$data['subject_level_id'].'"/>'; echo '<label for="subject_level_'.$data['subject_level_id'].'" class="subject_1">'.$data['subject_name'].'</label></td>'; $count++; //Increment the count } The names of the checkboxes come out fine, just that, is there any way to retrieve the values of the checkboxes into an array of some sort so that i could build a search query later? if($_POST(subject_level)) or if($_POST(subject_level[])) doesn't return true. does it make sense? im new to php so please forgive my ignorance. Help appreciated. Thanks! In my script, users login with their Username & Password. However, I'd like to be able to echo the email address used on their account.
I've tried adding the email to the session I'm not having much luck... Here's a piece of the login code(untouched); $username = $_POST['name']; $passwd = $_POST['passwd']; $query = "SELECT name,passwd FROM users WHERE CONCAT('0x', hex(passwd)) = '{$salt}'"; $result = mysql_query($query); $login_ok = false; if(mysql_num_rows($result) > 0) { $login_ok = true; } if($login_ok) { $row = mysql_fetch_array($result, MYSQL_NUM); $_SESSION['user'] = $row;I've also tried messing around with this piece below in a few different ways but still nothing. <?php echo htmlentities($_SESSION['user']['email'], ENT_QUOTES, 'UTF-8'); ?>Any help is greatly appreciated.. I have a basic table where I am trying to retrieve records that are filtered by a form request. Here is the code I have... $ps = $pdo->prepare("SELECT * FROM `Products` Where `Vendor` LIKE concat('%',?,'%'); $ps->execute(array($_POST['Vendor']));; echo "post=" . $_POST['vendor']; ////Displays correct data from form request $count = $ps->rowCount(); echo "Count=" . $count; ////Count = 0 although I know for a fact that there is 1 record that should be in there ////Used for display of records foreach ($ps as $row){ echo $row, PHP_EOL . "xxx<br>"; } Where is the incorrect code? I am new to php and pdo. Thank you in advance K Hi, I need to get data from an XML file, like the format below: Code: [Select] <ISBNdb server_time="2011-05-31T19:19:42Z"> <BookList total_results="1" page_size="10" page_number="1" shown_results="1"> <BookData book_id="build_your_own_database_driven_web_site_using_php_mysql_4th_" isbn="0980576814" isbn13="9780980576818"> <Title> Build Your Own Database Driven Web Site Using PHP & MySQL, 4th Edition </Title> <TitleLong/> <AuthorsText>Kevin Yank, </AuthorsText> <PublisherText publisher_id="sitepoint">SitePoint</PublisherText> <Details change_time="2009-04-02T00:30:10Z" price_time="2011-05-31T17:46:10Z" edition_info="Paperback; 2009-06-15" language="" physical_description_text="360 pages" lcc_number="" dewey_decimal_normalized="5" dewey_decimal="005"/> </BookData> </BookList> </ISBNdb> I need to know how you get the details from <title>,<AuthorsText><PublisherText> and Bookdata. Tried using the example on W3C, using simplexml_load_file but it only returns: Code: [Select] ISBNdb BookList: Code I'm currently using is: Code: [Select] $xml = simplexml_load_file("http://isbndb.com/api/books.xml?access_key=----&results=details&index1=isbn&value1=".$isbn); echo $xml->getName() . "<br />"; foreach($xml->children() as $child) { echo $child->getName() . ": " . $child . "<br />"; } i have this script called view.php Code: [Select] <?php include 'db.inc'; $file = clean($file, 4); if (empty($file)) exit; if (!($connection = @ mysql_pconnect($hostName, $username, $password))) showerror(); if (!mysql_select_db("Php_test", $connection)) showerror(); $query = "SELECT mime, data FROM file WHERE id = $file"; if (!($result = @ mysql_query ($query,$connection))) showerror(); $data = @ mysql_fetch_array($result); if (!empty($data["data"])) { // Output the MIME header header("Content-Type: {$data["mime"]}"); // Output the image echo $data["data"]; } ?>after i have db.inc Code: [Select] <?php // These are the DBMS credentials $hostName = "localhost"; $username = "root"; $password = "oxioxi"; // Show an error and stop the script function showerror() { if (mysql_error()) die("Error " . mysql_errno() . " : " . mysql_error()); else die("Could not connect to the DBMS"); } // Secure the user data by escaping characters // and shortening the input string function clean($input, $maxlength) { $input = substr($input, 0, $maxlength); $input = EscapeShellCmd($input); return ($input); } ?>and i have my page witch part of it is this Code: [Select] <?php include 'db.inc'; $query = "SELECT id, name, mime FROM file"; if (!($connection = @ mysql_pconnect($hostName, $username, $password))) showerror(); if (!mysql_select_db("php_test", $connection)) showerror(); if (!($result = @ mysql_query ($query, $connection))) showerror(); ?> <h1>Image database</h1> <?php if ($row = @ mysql_fetch_array($result)) { ?> <table> <col span="1" align="right"> <tr> <th>Short description</th> <th>File type</th> <th>Image</th> </tr> <?php do { ?> <tr> <td><?php echo "{$row["name"]}";?></td> <td><?php echo "{$row["mime"]}";?></td> <td><?php echo "<img src=\"view.php?file={$row["id"]}\">";?></td> </tr> <?php } while ($row = @ mysql_fetch_array($result)); ?> </table> <?php } // if mysql_fetch_array() else echo "<h3>There are no images to display</h3>\n"; ?>i have do it right but for some reason it doesnt displays the pictures the type and the name are displayed normally but not the picture!! instead of them there are small icons of not existing pictures.. please i want help i really need to do it Hi All, small question here. I was just playing around with a small script I made to obtain an ip-address, remove the dots and than glue the parts together. Not for any use but for practice. But I am having difficulties to accessing the array values. But maybe that because its the first time i am using explode() and print_r. If someone has a spare minute I would be pleased to be enlightened. <?php $ip=$_SERVER['REMOTE_ADDR']; echo $ip.'<br />'; $cleaned_ip = substr($ip,0,6); echo $cleaned_ip.'<br />'; $cleaned_ip2 = print_r(explode('.', $ip, 6)).'<br />'; // this is the point where I dont know how to get the array values. // echo $cleaned_ip2[0].[1].[2]; that doesnt work. ;( ?> Hi, i have a transaction table which includes following fields. tran_ID,account_number,account_type,transaction_type,amount,Date I want to know how these data can be retrieved and display in another table. The table is filled with several records. Thanks, Heshan Hello all, I'm currently working on a project and it is the first time I have had to store/retrieve an array with PHP and MySQL. Basically its a website that has a list of discounts/coupons on it. People can register and submit their discounts and such. I am storing an array for who is eligible for the discount, as well as which categories the discount falls under. I did some googling and there seems to be tons of thoughts on the best way to do this. Some say to use implode/explode, some say to serialize/unserialize, I was just wondering if there is a common, concrete way to do this? I will need to be able to search the array for its contents. So if children are eligible for the discount, I need to be able to store that in a database, retrieve it later, and search it for only "Children" so I can display the discounts available only to children. If someone could please advise the best way to do this and post some examples, it would be greatly appreciated. I learn best with examples that are explained properly. Hello, I am having a problem with retrieving information from my database. I am kinda new in programming industry, and with the error message displayed, I can't pinpoint what went wrong in the code. Here is the PHP code: <?php include("dbconnection.php"); if(isset($_POST["btnSubmit"])) { $id = $_POST["id"]; $territory = $_POST["territory"]; $job_title = $_POST["job_title"]; $area_of_work = $_POST["area_of_work"]; $employer = $_POST["employer"]; $location = $_POST["location"]; $job_title = $_POST["job_title"]; $date_posted = $_POST["date_posted"]; $closing_date = $_POST["closing_date"]; $department = $_POST["department"]; $gender = $_POST["gender"]; $first_name = $_POST["first_name"]; $last_name = $_POST["last_name"]; $title = $_POST["title"]; $telephone = $_POST["telephone"]; $address_1 = $_POST["address_1"]; $address_2 = $_POST["address_2"]; $address_3 = $_POST["address_3"]; $country = $_POST["country"]; $city = $_POST["city"]; $postal_code = $_POST["postal_code"]; $website = $_POST["website"]; $email_address = $_POST["email_address"]; $cg_comment = $_POST["cg_comment"]; $date_emailed = $_POST["date_emailed"]; $mailing_comments = $_POST["mailing_comments"]; $telesales_comments = $_POST["telesales_comments"]; $query = "UPDATE contacts SET territory= '".$territory."', job_title = '".$job_title."', area_of_work = '".$area_of_work."', employer = '".$employer."', location = '".$location."', job_title = '".$job_title."', employer = '".$employer."', date_posted = '".$date_posted."', department = '".$department."', closing_date = '".$closing_date."', gender = '".$gender."', first_name = '".$first_name."', last_name = '".$last_name."', title = '".$title."', telephone = '".$telephone."', address_1 = '".$address_1."', address_2 = '".$address_2."', address_3 = '".$address_3."', country = '".$country."', city = '".$city."', postal_code = '".$postal_code."', website = '".$website."', email_address = '".$email_address."', cg_comment = '".$cg_comment."', date_emailed = '".$date_emailed."', mailing_comments = '".$mailing_comments."', telesales_comments = '".$telesales_comments."' WHERE id = '".$id."'"; mysql_query($query) or die(mysql_error()); echo "<script> alert('You have successfully updated a record'); window.location = 'view.php'; </script>"; } $query = "SELECT * FROM contacts WHERE id = '".$_GET["id"]."'"; $result = mysql_query($query, $connection); if(mysql_num_rows($result) > 0) { $territory = mysql_result($result,0, "territory"); $job_title = mysql_result($result, 0, "job_title"); $area_of_work = mysql_result($result, 0, "area_of_work"); $employer = mysql_result($result, 0, "employer"); $status = mysql_result($result, 0, "status"); $location = mysql_result($result,0, "location"); $department = mysql_result($result,0, "department"); $date_posted = mysql_result($result,0, "date_posted"); $closing_date = mysql_result($result,0, "closing_date"); $gender = mysql_result($result,0, "gender"); $first_name = mysql_result($result,0, "first_name"); $last_name = mysql_result($result,0, "last_name"); $title = mysql_result($result,0, "title"); $telephone = mysql_result($result,0, "telephone"); $address_1 = mysql_result($result,0, "address_1"); $address_2 = mysql_result($result,0, "address_2"); $address_3 = mysql_result($result,0, "address_3"); $city = mysql_result($result,0, "city"); $country = mysql_result($result,0, "country"); $postal_code = mysql_result($result,0, "postal_code"); $website = mysql_result($result,0, "website"); $email_address = mysql_result($result,0, "email_address"); $cg_comment = mysql_result($result,0, "cg_comment"); $date_emailed = mysql_result($result,0, "date_emailed"); $mailing_comments = mysql_result($result,0, "mailing_comments"); $telesales_comments = mysql_result($result,0, "telesales_comments"); } ?> The error I am getting is: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\invent-asia\edit_client.php on line 268 Line 268 in the code is: Quote if(mysql_num_rows($result) > 0) { - This one is line 68 $territory = mysql_result($result,0, "territory"); Immediate response is well appreciated. Thank you very much! |