Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Parse An HTML File Using Php To Get Some Specific Info


I want to parse an HTML file using php to get some specific info from that page. How do i get started? Do u have any tutorials about it?




View Complete Forum Thread with Replies

Related Forum Messages:
Retrieving Specific File Info...
Ive got a file which contains the following data:

<option value="13">African Nations Cup XXV</option>
<option value="16">asd</option>
<option value="7">Champions League</option>
<option value="1">English Premiership</option>

What Id like to do is get the maximum value, so 16. Ive used file_get_contents to bring the file into a string, but now Im stuck getting that max value out. Unless theres a function for this, I believe the direction I would need to take is collect all value numbers using some string manipulation function, throw them all into an array, and just get the max value of the array.

Is there an easier way?

View Replies !
Parsing File For Specific Info.
Ok first, I copied the console text from a game I've been playing. Now I want to make a PHP script that will search through the file line by line and check for 'Death Messages' where I've killed someone or where I've been killed.

I want to be able to slice it all up and save who was killer, who was victim, and what the weapon was. Just having trouble coming up with the best way to go about it.. Code:

View Replies !
How To Parse A Doc File To Get Specific String
i want to parse a doc file like a resume or cv and just take out the value of name or a email id can nybdy pls tell me or give me the reexp to just extract the name or mail id fron the whole contents of doc file.

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 !
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 !
Specific Info From Mysql
I was wondering if I can get advise on how to pursue this: I have a db with a various user tables and various fields. I would like to have a user login and see only their specific data. I have seen innumerable login scripts, but I am overwhelmed. I am looking for the simplest solution. Could I create some kind of filter that would look for a field usr and a field pass that would spit out the user record that matched those?

View Replies !
Fetching Specific Info
I am doing a validation statement where i will get the number of ticket from my database and validate against the one entered by the user($_POST[ticket]) to see if there is enough ticket.

$db = new Database('localhost','lucashii',?','movies');
$sql = 'SELECT ticket_num FROM movie_ticket WHERE movieticket_id = "'.$_POST['id'].'"'
$result = $db->query($sql);
$row = $db->sql_fetchrow($result);
$ticketa = $row['ticket_num'];
if ($ticketa < 0) {
echo 'TResult1='.urlencode('Ticket Sold Out');
} else{$_POST['currentTicke'] = $_POST['currentTicket'] - $_POST['ticket'];
$db = new Database('localhost','lucashii',?','movies');
$sql = 'UPDATE movie_ticket SET ticket_num = "'.$_POST['currentTicke'].'" WHERE ticket_id = "'.$_POST['id'].'"'
$db->query($sql); echo 'TResult1='.urlencode('Success');
}
?>

View Replies !
What Is The Best Way To Display Specific Info From A Table?
I am hosting a youth sport site and I want to display schedules by select teams.

I thought that I would want a drop down menu to select one of our 35 divisions, then a secondary search by team of that previously selected division menu.

My schedule is in a table with the fields:
* division
* date
* time
* home_team
* h_score
* visiting_team
* v_score
* field

I see problems, since secondary drop down menu would have to search two different fields.  Any suggestions and hint to where I would even start?

View Replies !
Obtaining Specific Info From A Database
i have a products table that contains all the products i will have on my website however for the configurator i want to select only the items, accessories extras that i want to selected the computer.

i don't want to send out a SELECT query for each item...is there a way to send out one query that will fetch all the items i need?

I thought it would be good to have an array of product id's and the have a query which would grab the info i require based on these id's Code:

View Replies !
Edit Specific Info In MySQL Table
I am hosting a sports website and am processing schedules for the particpating clubs to assign times and field assignments. An example table is as follows:

<table id="table1">
<tr>
<td vAlign="top" style="border-style: solid; border-width: 1px"><b>Club</b></td>
<td vAlign="top" style="border-style: solid; border-width: 1px"><b>Age</b></td>
<td vAlign="top" style="border-style: solid; border-width: 1px"><b>Date</b></td>
<td vAlign="top" style="border-style: solid; border-width: 1px"><b>
Time/Notes</b></td>
<td vAlign="top" style="border-style: solid; border-width: 1px"><b>Time</b></td>
<td vAlign="top" style="border-style: solid; border-width: 1px"><b>Home</b></td>
<td vAlign="top" style="border-style: solid; border-width: 1px"><b>
Visitors</b></td>
<td vAlign="top" style="border-style: solid; border-width: 1px"><b>Field</b></td>.

View Replies !
Using PHP To Parse Emails And Print To Specific Printer
We're trying to write a script that will monitor 6 email addresses and
if an email arrives it will print to a specific network printer based
on the email address. So if the address is 'department1@domain.com' it
will print to 'dept1ptr'. Each printer can be setup either on a
network print server or printed to directly via IP address... they're
all HP printers.

Any suggestions on a route to go with this? I'm very familiar with PHP
but I've never written a script to do something like this... and if PHP
isn't the right avenue to take, I'd love other options.

View Replies !
Login Into Yahoo Finance To Get And Parse Stock Info? CURL?
I need to get to my stock watch list and parse some stock qoutes for my personal watch/alert program I am building, So I have to goto my 8th portfolio...

http://finance.yahoo.com/p?v&k=pf_8, but it needs my username/password combo before going in (i already have these of course but want a way to get 'into the' page via php).

how can i pass these in, and get the HTML contents of the page, which once in a variable i know how to cleanup and parse? I think i read something about cURL and i was wondering if someone could help me with a quick n; dirty example on what to use.

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 !
Specific HTML Tags
I have an HTML document that uses these opening tags

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />

If these tags are not in my file it won't show correctly, but whenever I save the HTML as .php and preview it, it gives me the following error:

Parse error: syntax error, unexpected T_STRING in c:Wampwww
ew_lbofixit.php on line 1

Is there any way to work around this?

View Replies !
Extracting Info From HTML
Im needing some help with writing a PHP script. Basically all i want to do is write script that can extract data from a table in html format into a MySQL database on my server.

View Replies !
Passing Info From Html To Php
I'm trying to pass info from a "Drop list" in an .html form into a .php which will then query a database. It doesn't work and I wondered if I'm missing something easy?

If I junk the dropdown list and just put a "textfield" there is no problem but I want to have the fixed choices list. Here is the code:

View Replies !
Get Info From A Html Page With Php
im looking for a way to get info from a html page in php i have a code that was sapose to work but no longer does any one have any ideas on how to make it work? here is the Code:

View Replies !
Pass Info From To HTML
I'm wanting to pass a value from PHP into a hidden input in HTML. I don't want it to travel in the URL if possible.

for example to help paint the picture.

From PHP
I want to pass this: value="true"

To HTML
<input type="hidden" value="false">

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 !
How Do You Get Html To Parse As Php
I'd like to configure one domain to parse an .html file as php. Is this possible? I have root access on the server.

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 !
Extracting Img Tag Info From HTML Source
I'm having a bit of a brain meltdown trying to figure this out. If anyone has a suggestion I could try, that would be excellent.

I'm trying to extract specific pieces of data from an html source file. In particular image tag information. If my file contains lines similar to:

<a href="images/picture.jpg" target="_blank"><img src="thumbnails/picture.jpg"></a>

I'd like to be able to extract the a href URL and the img src as two seperate variables and ignore any other HTML source and tags inside of the file. For all intents and purposes ending up with an array of the following:

$link[0]="images/picture.jpg";

$thumbnail[0]="thumbnails/picture.jpg";

View Replies !
Retrieveing Info Passed From Html
i have a flash banner on a page that when clicked sends the browser to another page. This banner is linked to a php file that counts the amount of clicks on the banner. In the html page for the flash banner I have: Code:

<embed src="swfs/banner1.swf?clicktag=forms/tracking/bannertrace.php&clickheader=http://www.somewebsite.com" width="570" height="80" align="middle">

in my php file I have: PHP Code:

<?php
$traceFile = "banner/clicktrace.txt";
$clickURL = $_GET(clickheader);
$fh = fopen($traceFile, 'r'); $theData = fread($fh, filesize($traceFile));
fclose($fh);$fw = fopen($traceFile, 'w');
$theData = $theData+1; fwrite($fw, $theData);

However the clickheader variable that contains the URL does not get passed to the php file.

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 HTML And Add Quotes
Can someone make me a regex that adds quotes around stuff in html for example:

<form action=hi method=post> to <form action="hi" method="post">

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 !
How To Parse HTML TABLE
I have a problem with parsing html table. I need a script witch will pars html table from one site to another.

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 !
Parse A Html Page
I would like to parse a html page and extract all image names and thier alt attributes.

View Replies !
PHP Displaying Info Input On HTML Form
I'm in an exercise where I've created an order form in HTML. The form displays properly and allows me to input certain test order info just fine. The relevant lines in the HTML form are: Code:

View Replies !
HTML Presentation Page For Uploaded Info?
I've seen a lot of posts about uploading files, but not much about what happens afterwards. Can someone point me to a tutorial, post or book which will help me solve this problem:

I'd like to have a form where users can upload a photo, add a short bio, put in some contact info, and have all of this information stored in a database (natch).

Then I'd like for this form to take this user's data and put it into an html presentation template. Ideally, members would sign in and be able to modify their own profiles as well as view other profiles.

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 !
Parse And Extract Information From HTML Using SQL
This is a question that seems to have been asked here a few times recently. I've just come across this on PHP Classes and thought it might be of interest to anyone trying to do this, I've not used it myself so it is "Sight unseen" Code:

View Replies !
Filling My SQL Database With Info From HTML Source Code?
I am desperatly browsing around trying to find some way to add data to mySQL from raw HTML sourcecode.

I basicly have HTML pages showing lots of info on work, and I want to take that info - add it to mySQL so I can sort, select and browse the information in a better way.

Hope someone knows what I mean.. (many online textbased games have this on various fan pages for calculating purposes, ie. Earth2025 and Utopia)

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=&#392;' CELLPADDING=&#392;'
BORDER=&#390;'><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=&#392;'
cellpadding=&#392;' border=&#390;'><tr>";
$character_creation_form .= "<td>New Character
Name:</td><td><input type='text' name='new_character_name' size=&#3930;'
maxlength=&#3930;' 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=&#392;' CELLPADDING=&#392;'
BORDER=&#390;'><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 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 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 !
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 !
Posting Local File Info To A Php File!
I have a script that I run locally and im trying to get the info to post to a php file so that I can view it in a browser. What I need to know is how to set up the receiving php to post it to the .html . Now I thought it went along the line of creating the php file and putting it on the root of the server then running the local script against a that php info file and it would dump the info to a browser but it wont work like that (I'm guessing cause it's a local script and not on the web)

I know this line is sending it to the .php in that directory but I don't know how to set up the receiving php I guess is my problem.

gosub phpsend www.xxxxxxxxxxxxx.com /xxxxx/xxxxxxxxx.php %sendstring

I guess what I need to know is whats the best way to post the received data to a browser after the script runs. Or to set up the receiving php file as for outputting it I can create the page I just need to know how to receive it .

View Replies !
Writing To A Specific Place In A File
I have a text file. I would like to write a line of data as the first
line and then another as the last line. What is the easiest way to do
this using php 4?

View Replies !
Fwrite At Specific Point In File
I'm doing a little feedback type feature on one of my sites, so a visitor can just type in their name and comment and it's posted to a page (feedback.html) which is displayed in an iframe.

This all works fine and dandy but when I write to the feedback.html page the new comments obviously go on the bottom, so that after a few feedback comments have come in you need to scroll down to read the new ones, so I would like it so that it posts the new comments at the start of the new file. This can't be literally the start though, as the feedback.html has three lines of headers, or 84 characters.

So what I need is a way to point the file pointer at the 85th character or the fourth line and perform the fwrite there. I've tried using fseek but haven't had any joy with that. Does anybody know what I'm talking about and is anyone able to help?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved