Parse Text From HTML Website, Dump Into DB
I am working on a script to extract statistics (which is updated daily) from
a website, and insert them into a MySQL database. I want to take this
website:
http://www.usatoday.com/sports/bask...players0304.htm
and strip off all the HTML tags and etc, make it look like
http://www.enlhoops.com/ratings/parsed.txt
and then insert each players stat line into the database.
I have begun writing the script, getting the file, striping html tags off,
but that doesn't seem to work too well.
View Complete Forum Thread with Replies
Related Forum Messages:
Dump Form Data To A Text Or XML File?
I have a form I've been using for a couple years to send email to me as feedback from my website. Now I'd like to use it to save a subscriber's information for a mailing list. Ideally, it will be moved into an XML file that I can easily output with XSLT. Anyway, here's the script. What would I need to modify to make this change? Not that the print line at the end is just there as a placeholder for a true redirect page. Code:
View Replies !
Script To Parse Text From A Text File.
I've got a problem building a script to parse text from a text file. Everything works great for unique strings of text, but there also strings in the text file which are not unique. E.g. the text file contains the following text "bla blaa text=bloeb1 blabla text=bloeb2 bla" I want to extract the 'text' variables (with values bloeb1 and bloeb2) from this text file but I don't know how much text variables are present in the file. So, it's possible that there is also a bloeb3 or a bloeb10.
View Replies !
RemoveHandler .html .htm (parse Php In .html Files)
I want to parse php in .html files. I put this in .htacces file: RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html Its work, but some of my php aplications have urls: www.mysite.com/this-is-page without .html in the end how to parse that? Which code I must use.
View Replies !
Get Text From My Other Website
say i have two websites, A and B on websiteA index.html i have a table cell which contains a quote that i manually change regularly. I want to write some code in my websiteB index.php that synchronizes with the index.html websiteA, displays the changes on websiteB indx.php. So that everytime i made changes to the quote on index.html websiteA, the index.php wesiteB automatically reflex the change made.
View Replies !
Parse Text
I have a blog script, this is the part that shos the blog entry's Code: <?php echo $vEntries[$i]['entry']; ?> How would I go about having it parse image files and url's without the user puting in any extra html or tags (ie; user puts in http://www.test.com/test.jpg) It automaticly shows the image in the post?
View Replies !
Using PHP To Parse Through HTML
I'm using PHP 4 and trying to parse through HTML to look for HREF attributes of anchor tags and SRC attributes of IMG tags. Does anyone know of any libraries/freeware to help parse through HTML to find these things. Right now, I'm doing a lot of "strstr" calls, but there is probably a better way to do what I need.
View Replies !
Html To Parse Php
i want my html files to parse php files. how do i do it? i have access to httpd.conf what should i add? is it not advised to do something like that?
View Replies !
Parse Php Through Html...
I'm trying to get my php pages to parse php within HTML, instead of php brackets. Basically instead of having: lets echo a variable/constant: <?php echo $somevariable . ' or ' . SOMECONSTANT; ?> I want to use somhing like: lets echo a variable/constant: {$somevariable} or {SOMECONSTANT}Is this at all possible? I'm not wanting to do anything more difficult than echoing simple variables or constants..
View Replies !
Parse Html
I want to chunk a html page and parse that page using php.ie that html page contain many data.I want to retrive that data using php and want to save in a database.
View Replies !
Text Only Version Of A Website
I am looking for a script and advice that will let me offer a text only version of a website. These scrit should work with pages generated dinamically and otheres that are static.
View Replies !
Best Way To Extract Text From Website
I am trying to extract the text from about 1500 pages so I can dump the info into a database, but I would like to be able to keep the <br> and formatting around the text, but strip out all of the rest of the pages code.
View Replies !
Parse Text - Strip The Www.
I have a form which allows a user to enter a URL and then stores that information in a SQL db. When I get the URL I want to strip the protocol info and the path info. For example, if a user inputs "http://www.google.com/page1/index.php" I want to strip it down to "google.com". Likewise if a user enters "www.google.com" I would like to strip the www.
View Replies !
Parse PHP Code In .html??
I was wondering if it's possible to parse PHP code in .html documents without requiring root access (since I'm on a virtual server). I want to make a two line call to a log program, but I don't want to have to change all of my .html files to .php.
View Replies !
Parse A Html Site
does anybody know a script that cachtes any data from a web site (html) and put it in a csv or something? I think parse is here the magic word or?
View Replies !
Parse A Html Document
Anyone have any ideas how to parse a html document. I am trying to extract out specific information from the page. Also, what do you do if the page is dynamic (e.g. a cgi generated page) how do you find it?
View Replies !
Parse Html Page
How can I import a html page with my php script? I have a simple html page that actually just generates a simple table of values. I just want to strip the values to insert in to a database. How do I import the html page to my php script to parse it?
View Replies !
Parse HTML From Within A PHP Script
I'm writing my website backend. This consists of a series of pages for adding and updating information about widgets to a database. Most of the pages have bene very simple, however I elected that three fields would accept HTML as there data by necessity. These three fields contain a manufactures description of the item, a description written specifically by the company, and lastly the spec sheet on the product. I'm designing the back end page that will allow modification of existing database items. I'm using <textarea> tags for the data. The problem being that I believe if I write a line like: echo "<textarea name="$fieldname[$i]" rows="5" cols="25">$thevalue[$i]</textarea> $theValue will be interpreted as the HTML it is instead of displaying the HTML so it can be edited and resaved to the DB. I haven't finished all the entire script so I haven't been able to test that theory yet, so if I'm wrong I'd be happy to hear it. if I'm right how can I get around it?
View Replies !
Parse HTML ASCII
When parsing HTML is it possible to have all the ASCII codes converted to their real values first so that I do not need to search for them to exclude them. For example the following is retrieved as a price however it would be easier to extract using a regex if the code was first converted to a dollar sign: <h3> $249,000 </h3>
View Replies !
How To Parse This Into HTML Tables
I'm trying to parse a file in order to get it displayed onto a webpage using HTML and tables. I got a good deal of the parsing done but there's a problems that I can't solve. So here is a part of the file Code:
View Replies !
Getting Multi Lined Text From A Website
<?php $rs = file_get_contents("http://runescape.com/index.ws"); $pos = strpos($rs, '<fieldset class="menu poll">'); $number = substr($rs, $pos + 1, 100); $pos = strpos($number, '</fieldset>'); $number = substr_replace($number, '', $pos); echo $number; ?> Thats the code I'm using right now, but it dosn't work for the text I'm trying to get, the text is multi lined, this is the text. The words "What would you do #3" change every week, can anyone see something wrong in the code?[/QUOTE].
View Replies !
How To Use To Parse Text And Insert Into Mysql
I need to read a text file and then insert the values into different fields in a mysql database. Each line in the data is in the form of: last, first title, department Where the fields are last, first, title and department. How would I parse this and insert it into a table? As you can see, not all fields are comma delimited but the order is consistent. Is there a simple way to somehow read it in a word at a time and strip the commas entirely and rely on the whitespace as a delimiter?
View Replies !
How Do I Parse PHP Code Within An HTML File?
I'm trying to figure out a way to save message bodies of the various e-mails I send from my site into HTML pages and then import them when I send the e-mails. But I've never tried anything like this before so I'd appreciate some help. Here's an example of the code I'm using: Code: $email_body = file_get_contents("emails/application_approved.htm"); I can import the HTML files without problems, but I've also got PHP variables in the HTML code and I need to know how to parse those variables. Is it even possible?
View Replies !
WinXP/IIS Set Up For PHP To Parse .html Extensions
I just installed PHP (4.3.3) on a WinXP (SP1) system using IIS (5.1) as the web server. I am using FrontPage 2002 and would like to be able to debug my PHP scripts locally. Since FP does not handle the .php extension as a web page (edit, display, navigation, etc.), I am trying to set it up to parse files with the .html extension. I have added the .php and .html extensions to the Application Configuration page of IIS and I have also applied some regedit changes suggested by the documentation. All to no avail. The .php extension works, the .html does not.
View Replies !
How To Use .htaccess To Parse Only .html Files As .php?
I am trying to make my server (Apache) parse .html files as .php. I found this line of code: ForceType application/x-httpd-php placed it in an .htaccess file and uploaded it to the directory I wanted it to work. And it worked; my .html files are all parsed as .php. But, apparently, so are my images, so they aren't loaded into the pages. And something else, my css file isn't found anymore by Netscape and Mozilla, while IE has no problem... I'm calling my css file with @import url(all.css); in the <style> block in the head of my .html files. How do I make the server parse _only_ .html files as .php, and why don't Mozilla and Netscape find the css file? (They did before I sent the .htaccess file)
View Replies !
Parse .html As Stopped Working
I recently upgraded an old 4.2.2 PHP to 4.3.11 One change I made after was to get my .html files to parse thru PHP. Yes, I've read for years not to do this, but I do anyway. I accomplish this by changing: AddType application/x-httpd-php .php to AddType application/x-httpd-php .php .html But now, all my apache redirects don't work, and the apache error pages want to download. The .html parse thru PHP, and ofcourse .php is fine. I've covered everything I know, and would like to know if anyone else has come across before.
View Replies !
Paginate Text, In A Fixed Height Website?
I am preparing to built a website that requires the text be split into as many pages as is needed to fit into a set website size. There will be no scrolling up or down, e.g. the viewable area of the website is 500px x 300px. Its a basic custom-built CMS using PHP and MySQL. How can I detect when my set width / height has been filled.... and so create more pages? Maybe this is not a pure PHP job, perhaps with Javascript as well?
View Replies !
Parse A Text DB File And Seperate All Information In It
I have a little brain freeze going here. I can't remember how to do this. I'm trying to parse a text DB file and seperate all information in it so that I can insert them into MySQL as seperate values in seperate fields. for example, 1 | howdy | there That would be three peaces with three different fields in MySQL. I know I've done this before but can't for the life of me figure out how I did it. All I need is somebody to jog my memory and get that little brain of mine weorking again.
View Replies !
Parse Error On The Last Line Of Code </html>
/// here is the code i'm getting a parse error on the last line of the code which /// is </html> any help will be much appreciated. <?php session_start (); require_once('connect.php'); if ($_SESSION['username']){ //test for logged-in $query = "SELECT status FROM accounts WHERE username='".$_SESSION['username']."'"; $result = mysql_query ($query) or die("<b>A fatal MySQL error occured</b>. <br> Error: (" . mysql_errno() . ") " . mysql_error()); $row = mysql_fetch_array ($result,MYSQL_NUM); if ($row[0] == 0){ $error_message .= "<P>Your account has been frozen. Email the <A HREF='mailto:account_status@severedrealm.net'>webmaster</A> for more information.</P>";} if ($row[0] == 1){ $query2 = "SELECT name, hp, gold, exp FROM characters WHERE username='".$_SESSION['username']."'"; $result2 = mysql_query ($query2) or die("<b>A fatal MySQL error occured</b>. <br> Error: (" . mysql_errno() . ") " . mysql_error()); $character_table .= "<TABLE CELLSPACING=ƈ' CELLPADDING=ƈ' BORDER=Ɔ'><TR><TD>Name</TD><TD>Hit Points</TD><TD>Gold</TD><TD>Experience</TD><TD>Delete</TD></TR>"; $x=0; while ($character = mysql_fetch_array ($result2)) { $x=$x+1; $character_table .= "<TR><TD>".$character[1]."</TD><TD>".$character[2]."</TD><TD>".$character[3]."</TD><TD>".$character[4]."</TD>"; $character_table .= "<TD><form action='character.php' method='post'><input type='hidden' name='character' value='".$character[1]."'><INPUT TYPE='submit' NAME='delete_character_submit' VALUE='delete_character'></FORM></TD></TR>";} $character_table .= "</TABLE>"; if ($x >= 1){ $error_message .= "<P>You have too many characters. You must delete ".$x."before you can create another.</P>"; }else{ $character_creation_form .= "<FORM ACTION='character.php?op=create_character' METHOD='post'>"; $character_creation_form .= "<table cellspacing=ƈ' cellpadding=ƈ' border=Ɔ'><tr>"; $character_creation_form .= "<td>New Character Name:</td><td><input type='text' name='new_character_name' size=ཚ' maxlength=ཚ' value=''/></td></tr>"; $character_creation_form .= "<tr><td></td><td><input type='submit' name='New_Character_Submit' value='Create Character'></td></tr></table></FORM>";} if ($row[0] == 2){ $query3 = "SELECT name, hp, gold, exp FROM characters WHERE username='".$_SESSION['username']."'"; $result3 = mysql_query ($query3) or die("<b>A fatal MySQL error occured</b>. <br> Error: (" . mysql_errno() . ") " . mysql_error()); $character_table .= "<TABLE CELLSPACING=ƈ' CELLPADDING=ƈ' BORDER=Ɔ'><TR><TD>Name</TD><TD>Hit Points</TD><TD>Gold</TD><TD>Experience</TD><TD>Delete</TD></TR>"; $x=0; while ($character = mysql_fetch_array ($result2)) { $x=$x+1; $character_table .= "<TR><TD>".$character[1]."</TD><TD>".$character[2]."</TD><TD>".$character[3]."</TD><TD>".$character[4]."</TD>"; $character_table .= "<TD><form action='character.php' method='post'><input type='hidden' name='character' value='".$character[1]."'><INPUT TYPE='submit' NAME='delete_character_submit' VALUE='delete_character'></FORM></TD></TR>";} $character_table .= "</TABLE>"; if ($x >= 2){ $error_message .= "<P>You have too many characters. You must delete ".$x."before you can create another.</P>"; }else {
View Replies !
Parse HTML Table Rows Into Array
I have a script that extracts an HTML table from a page into a text string. I would like to parse each row of the table into an array named "$rows". I would like to keep the html intact so that I could re-create the same table like: Code:
View Replies !
Using PHP To Parse Html Tables And Extract Values
I've been presented with a task of parsing multiple .jsp's (this is after they have been executed server side so I guess for all purposes its actually a html file). Anyway each of these pages have large complex tables displaying a lot of reporting data for one of our systems. My original method of carrying out this task was to go into the code and get the actual DB querys that the page executes and have this more as a bash based solution. However after spending several days trying to hack my way through a jungle of 100's of querys which dont hold to any naming convention Im going to plan B. So here's what Im looking to do. Get php to construct the correct url for the jsp. What I mean by construct is to make the url while dynamically inserting the correct values into the url as it uses GET to set the date range of the information it writes to the browser. Once its done that and requested the page is processed I want php to search through the page and find the results that Im looking for, assign them to variables and finally format the information from all the different jsp's into one php page. One nice thing is that I'm able to modify the .jsp's to wrap a comment around the data I want for example. I think this should remove the hardest part of the job which is having php identify what values I actually want. #take_this_value# 1234556 ####### What I dont know is how to get PHP to request the url I create,parse it and extract the values. I'm guessing this is a job for wget and regular expressions but Im not too sure where to start (or if there is more appropriate functions to use).
View Replies !
Parse String For Urls, But Not Html Links
I've got this function to convert any urls into the proper links for my CMS. However, if I want to put in my own link <a href="http://www.domain.com">A link to domain.com</a> (rather than the basic url www.domain.com), this function really stuff's it up. Code:
View Replies !
Parse Returned Html Shipping Rate Value
How can I extract as a var, the shipping rate value returned from the HonKongPost website's html webpage/result. I need to extract whichever value is displayed after the $: <input type="hidden" name="total_rate" value="$540"> Code:
View Replies !
Problem Using Htacess File To Parse HTML
I know that there are numerous posts on using an htaccess file to cause a server to parse HTML files for PHP. I've read them all (or at least most), but have not found any help for my problem. Does anyone know of a situation where modifying the htaccess file (or adding one to a specific directory within a hosting account) would cause the following behavior? I added an htaccess file consiting only of the line to a directroy where I would like .html files to be parsed for PHP: Code:
View Replies !
Parse An Html Page With Php To Pull Some Information
Im trying to parse an html page with php to pull some information from it and its not working correctly. I am running this to pull the ul from the page. its the only one on the page with the class directories and it doesnt stop pulling information after the end of the ul. preg_match('/<ul class="directories">(.*)</ul>/', $postResult, $array);
View Replies !
Re-making My Youth Group's Website Into Html With Some Basic Php
i am re-making my youth group's website into html with some basic php tags like inlucde (to save me changing every pages links on the nav. i have come to needing to redo the diary. the old HTML one was very simple with a drop down list to select the date range, and linked to a whole page. in the PHP version i would like to use similar, but, when the option is selected in the list, it changes the include tag, thus reducing bandwidth, and loading times. is this possible, and if so how?
View Replies !
Complicated Email Parse Or Text Extraction And Database Insertion
I am trying to strip some data out of numerous emails and place it in my database. I know that this seems as if it has been done before. But, this is a little different. First, the numerous emails all have a set of data that needs to be extracted and inserted into the database. Some of the data in the email is id, name, address, city, state, zip, company, etc. The catch is that the date is formated and presented differently in each email. Take into consideration the following email examples: - excert from email #1 ID:.............. 12345 Name:............ JOHN DOE Address:......... PO BOX 9999 City:............ Somecity State:........... CA Zip Code:........ 90210 ....
View Replies !
Text/plain Or Text/html?
I have a site (that someone else programmed) and I'm trying to fix a problem with the email formatting. There are five or six php scripts that send an email after registration, renewal, etc.. The only script that sends an email which is formatted correctly (ie, with line breaks in the body) is the one that says: $headers .= "Content-type: text/plain; charset=iso-8859-1"; The scripts that say text/html DON'T format the emails correctly. Isn't this backwards? Or should I just change all of the scripts to text/plain and not try to make sense of it?
View Replies !
Using Includes: Html Form Parse Data Inside 2nd Form.
i'm coming down the stretch, so to speak. i've got a lot of the separate things settled that i need for my main "date entry" form. due to the several data items which need to be collected by this form, i've decided to try using includes, which i've found isn't that tricky at all really. however, one of my includes needs itself to parse it's own little form data to result in the final entry to be submitted in the "date entry" form. perhaps doing this particular bit as an "include" is NOT the best option? Code:
View Replies !
Get And Html Text
I've to send many emails using a script that refresh every n seconds to avoid server timeout (can't be bypassed). Now, I've a loop wich detects how long does the script (a loop) takes to run. If the script is close to the 25 seconds, then I redirect to itself passing some values. One of the value is some html code. Then I get it in variable, add some text and so on, until threre is no more values in the database. Now, passing the variables I do this: ($message contains the HTML code). header('location:'.$_SERVER['PHP_SELF'].'?message='.$message); but doing a $message = $_GET['message']; I get nothing in the $message variable. why ? any idea? I've tried to do so: header('location:'.$_SERVER['PHP_SELF'].'?message='.htmlentities($message)); (I added htmlentities function) but it doesn't work. Any idea why ?
View Replies !
HTML Text Box
I am trying to retrieve a value from a MySQL database and display it using PHP in a text box. When I use <input type="text" value="<?= $value?>"/> only the first part of $value is displayed. Anything after a space is truncated. If i print $value elsewhere, it prints the whole string correctly.
View Replies !
HTML Is Trunctating PHP Text
Does anybody know why the text box on this page is trunctating $test to Mary? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows- 1252"> <title>New Page 1</title> </head> <body> <?php $test = "Mary had a little lamb"; ?> <form method="POST" action="edit_user.php" <p><input type="text" name="T1" size="30" value=<?php echo $test; ?> tabindex="1"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p> </form> </body> </html>
View Replies !
|