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.





Can PHP Parsing Xml Code ?


I am looking for a programming script to parse a xml file. Can PHP do it. The xml file is from other web site and i need to parse it into my html page.




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
BB Code Parsing
how would I go about coding a vBulletin style BBcode parsing engine?

eg. to translate [ b] something [ /b] into <b>something</b> etc

I know i need todo regular expression searches on the strings, however im a reg-exp newb and really need some guidance. Alternatively, are there any free premade classes etc I could us?

View Replies !   View Related
PHP Not Parsing This Code?
I'm trying to populate an array (with some strange characters). The problem I'm having is the page will ether come up blank, but show the code in the "page source". Or, some or all of the source is sent directly to the browser, like PHP didn't even parse it. I've tried this on a few different servers and get similar, though slightly different results. Here are some examples of what I'm trying to store: Code:

View Replies !   View Related
Help My Slow Parsing Code!
Here's my situation...I've been learning to write PHP for awhile and have been trying to rewrite my web site from plain old static pages to PHP versions. I've been learning based on what I want to do, put my links and articles in databases and allow comments and ratings.

I have a test page here:
URL

I've managed to write the PHP code to do just about everything I wanted, but it takes about 3+ seconds for the page to start to load (and it didn't when it was a static page). I know that this is because of my badly formed PHP no doubt. The routines do what I want, but there HAS to be a much more efficient way to get it done.

I'm going to post the code (stipped of font tags and error catching statements). Please advise the easiest way to streamline this code (and or SQL statements) in the best interest of the server processing time (any help would be great!):

<?php
//Start of routine for animation links
$usr = "user";
$pwd = "pw";
$db = "db";
$host = "host";

$cid = mysql_connect($host,$usr,$pwd);
?>

<?php
//We want the Animated Gif category
$category = "1";

$SQL = " SELECT * FROM links_temp";
$SQL = $SQL . " WHERE category = '$category'";
$retid = mysql_db_query($db, $SQL, $cid);

//Throw the links in an array - html table loop
print ("<center><table cellpadding=2 cellspacing=0 width=100% border=1>
");
while ($row = mysql_fetch_array($retid)) {
$siteurl = $row["siteurl"];
$sitename = $row["sitename"];
$description = $row["description"];

//cocatenate together anigif_ with each item id for unique rating value
$id = "anigif_";
$id = $id . $row["id"];

print ("<tr><td width=100% valign=top>");

//Lets start the form here for the voting to elimate a line break later
print ("<form method="POST" action="/test/rating4.php" onsubmit="return genwin()" target="newwin">
");
print ("<A HREF='$siteurl' target=_blank>$sitename</A>");

//While in the while loop lets start another db connection to get item ratings
$usr3 = "user";
$pwd3 = "pw";
$db3 = "db";
$host3 = "host";

$cid3 = mysql_connect($host3,$usr3,$pwd3);

$SQL3 = " SELECT * FROM ratings_temp WHERE item = "$id"";

$result3 = mysql_db_query($db3,"$SQL3",$cid3);
$num_rows = mysql_num_rows( $result3 );
if ($num_rows==0) { echo ("No Votes yet"); }
else {
print " $num_rows Votes, ";
$SQL4 = "SELECT AVG(value) AS avgRating FROM ratings_temp WHERE item = "$id"";
$result4 = mysql_db_query($db3,"$SQL4",$cid3);

print "Rating: " . mysql_result($result4,0) . "<br>";
}
mysql_close($cid3);
//end of the db connection for ratings

print ("$description<br>
");

print ("Vote for this Site!
");
print (" <select name="rating" size="1">
");
print (" <option value="5" selected>5 - Superb
");
print (" <option value="4">4 - Tasty
");
print (" <option value="3">3 - Average
");
print (" <option value="2">2 - Bland
");
print (" <option value="1">1 - Rotten
");
print (" </select>
");
print (" <input type="hidden" name="item_id" value="$id">
");
print (" <input type="submit" value="Vote">
");
print ("</form>
");
print ("</td></tr>
");
}
//end of the array subroutine making table rows

print("</table></center>");
//end of the table after the array ends
?>

View Replies !   View Related
Parsing Vbulletin Code
I've been coding a section where users can post a tutorial and have it show up. I've got the posting down, and I've got the list of tutorials down. I did it by making an invisible forum that it posts to.

What I still have to do is use AJAX to make a post clicked on the list show up in the main area, and I have to make it grab the most recent post out of the database and display it. Code:

View Replies !   View Related
Parsing PHP Code In MySQL Results Set?
I have a PHP script that pulls content from an MySQL database and returns a result set.

Is there a way I can put PHP code within a field in the database and have that code parsed as PHP code on returning a results set? If possible, I want just one field of the database parsed for PHP code. The results set is return as a straight result, not within a loop. Just inserting the <? PHP code thus ?> returns that as sources code not parsed.

View Replies !   View Related
Parsing String With Embedded PHP Code...
On my webserver right now, I have a folder of webpages with embedded PHP coding. Because the dynamic content changes very infrequently, I've written a script which generates a "static cache" of HTML pages from the PHP pages. It works by automatically looping through all PHP pages in the folder. For each, it reads the contents of the PHP file into a variable, then creates a new HTML page with the same name and writes the contents of the variable to it. After the process is complete, the cache of HTML files gets uploaded to the website for public viewing.

However, if the script reads the contents of the PHP pages through the local filesystem, the temporary variable (and thus the resulting static .html page) will have PHP code within it, which is obviously no good.

Therefore, at the moment, the script reads the contents of the PHP pages by opening an http connection to where they reside on the public webserver... this makes the contents of the temporary variable equivalent to the HTML that would be outputted when any user accessed the PHP page through the WWW, which is exactly what I want.

However... my problem is that the http connections are much slower than reading through the local filesystem, and moreover, I don't necessarily want the PHP pages to be publicly accessible through a webserver, which is currently required for the script to work. Is there any way that I can take a PHP string that has embedded PHP code and tell PHP to "parse the PHP out of it"?

View Replies !   View Related
XML Parsing - Newlines In The Code Disappaers
I have been trying to wrap my head arouns this, but I can't seem to get it to
work the way I want it to. Could someone helpful please tell me how I get this:

<function>
<name>array_push</name>
<examples>
<example>
<name>A way to do it</name>
<code>
$array = array("foo", "bar")
$array = array_push($array, "goo")
</code>
</example>
</examples>
</function>

To this:

array (
name -> array_push
examples -> array(
example -> array(
name -> A way to do it
code -> $array = array("foo", "bar")
$array = array_push($array, "goo")
)
)
)

My problems so far has been traversing the xml in a good way and:

1. After parsing, I am left with the code stripped of variables
'$array = array("foo", "bar")' becomes ' = array("foo", "bar")'

2. Newlines in the code disappaers, how do I make them stay?

Anyone feeling overly helpful and could give me an example to make the above
xml into the above array.

View Replies !   View Related
How To Make BBC Which Will Disable Any Code Parsing
how to make BBC which will disable any code parsing (BBCode, HTML - to display both without parsing it) and tell me, which font to use with it?

View Replies !   View Related
Parsing PHP Code In An HTML Page!
I am trying to run PHP code from an HTML file. In my HTML file I have the following code:

<?php include("<counter/counter.php");?>

Now I have read several threads here on Webmaster World, and I have concluded that I need to create a ".htaccess" file, and place the following code in it:

AddType application/x-httpd-php .php .htm .html

But, once I have done this, every time I visit a page on my site, I get the Open/Save this file dialog. It seems like the server is telling my browser, to open all HTML files with the external application called "application/x-httpd-php". Code:

View Replies !   View Related
PHP Code Parsing From Database Only Works Selectively
I have a script for my templating system which grabs PHP code from a mySQL database, and parses it. Here it is: PHP Code:

View Replies !   View Related
Command-line Php Displays Code Instead Of Executing Code
I am using CLI PHP to run a PHP script, c:wampphpphp.exe, but
instead of executing my script, it's actually displaying the raw code
instead.

How can I run my code using CLI PHP? I installed WAMP5 on WinXP.

View Replies !   View Related
Code To Read Code In Web Page's Source
Does anybody know how one can supply a URL to a PHP script and have it search for specific code in that web page?

View Replies !   View Related
Old Code Vs New Code - Language Syntax Change?
I've recently begun programming PHP again and have found my old code doesn't work anymore. It's been a few years since my code was written, and simple functions don't seem to be working. I've done a bit of research into the syntax again and found the following;

I used to use a function as such;

if ($REQUEST_METHOD=="POST") {
Now I've seen alot of the syntax is
if ($_SERVER($REQUEST_METHOD=="POST")) {
And referencing variables from the form is as such;
$_POST['variable']

Where previously I could reference them in the simple form; $variable

Has there been a language syntax change that would cause my old code to be obsolete? Is there a configuration line that could be changed to allow this old code to work?

View Replies !   View Related
Regular Expression :: Format Anything Within &lt;code&gt; And &lt;/code&gt;
Any regular expression wizards out their tonight? This is driving me crazy...trying to take a string full of HTML and format anything within the <code></code> tags using highlight_string().

$string = "<strong>This</strong> is some HTML!!!<code>echo "Hello, World!";</code>No more code!!!";
$pattern = "(<code>)*(</code>)";
$replacement = "";

$string = eregi_replace($pattern, highlight_string($replacement, true), $string);

*Thought that would work, but I know regular expressions are NEVER that easy. An hour later...

View Replies !   View Related
BB Code - Escape A Bracket In BB Code?
Is there a way to escape a "bracket" in BB code? The beginning of a bbcode
post I made starts with something in brackets [like this]. This causes a
strange thing to happen to the remainder of my post. Removing the brackets
makes my post normal. That shows me that I need to escape the brackets.
However, a simple backslash does not seem to do the trick i.e. this [wont
work]

I am not the administrator of the bb forum, just a poster. So I need to know
what to do on my end (as opposed to an adiministrator's power to
reconfigure, etc.

View Replies !   View Related
Translate Perl Code To PHP Code.
Can some one transfer this Perl into PHP? It is from the Spreadsheet-WriteExcel. PHP Code:

View Replies !   View Related
Convert Code Into Javascript Code
i have this php code:

header("Location: merge_cart.php?oldsession=" .urlencode($cart["sessionId"]));

now i want to convert this code into javascript code in php echo statement

e,g echo (" windows.location(......php) ");

does anyone knows how to do that.

View Replies !   View Related
Zip Code, Post Code, Town
does anyone know where i could get a MySQL db with postcodes and then towns that those postcode correspond to? i think this goes in php because i will develop all of my search in php.

View Replies !   View Related
Parsing .inc As .php
how do I parse .inc as .php files? Is it that useful to do this? Is it so unsafe to include() them otherwise? On my Linux box, I've got both httpd and httpd2.conf (don't ask me, it was auto-configured that way). I think both files are useful, but in which of these do I insert whatever you're going to give me?

View Replies !   View Related
URL Parsing.
I have come up with a couple ideas, but I would like some input on the most effective way to parse a URL from the body of a mail message. I have a small script which accesses mail for an account and retrieves the message body(imap_body). I want to parse through the body and pull out URL's, anyone have some good advice on a practicle method?

View Replies !   View Related
Parsing XML,RSS Through PHP
Do anybody know 'bout parsing RSS through XML (PHP). I wanna learn
RSS, but before that i must know XML. It would be helpful if anybody
guide me in the right direction from where to take start learning XML
(link, url). And after having the elementary knowledge 'bout XML i
would be able to parse RSS.

View Replies !   View Related
Parsing An URL
I want a PHP script that will for example split
http://example.com/dir/index.htm
into

http://example.com/dir
and
index.htm

It also needs to split up an URL with GET variables at the end. eg http://example.com/dir/link.php?id=123&no=abc

Any help would be appreciated...

View Replies !   View Related
Xml Parsing With Php
I use PHP (and PHP socket functions) to exchange very short XML
documents between two Flash clients like this:

<MESSAGE id="myid" text="mytext" />

I don't parse the XML document within PHP but send back the XML document
made by the Flash client to another Flash client with a php socket and
Flash parse it with its own XML parser ...

In order to detect errors or non-XML data I do like this (in php):

switch (true){
case ( ereg("<", trim($XMLdata)) ):
print 'xmldata'
break;
default:
print 'no xmldata'
}

(I must do this because Flash sends an empty "heartbeat" every 5
seconds, which is not XML data)

Now, I need to interpret my XML document inside php cause I want to make
php execute some commands when it receives a certain type of XML element.

XML data that can be sent from Flash :

<MESSAGE id="myid" text="mytext" /> or
<COMMAND1 /> or
<COMMAND2 /> or
or an empty string "" .

(in php) I can do :

switch (true){
case ( ereg("<MESSAGE", trim($XMLdata)) ):
print 'xmldata is a txt message'
break;
case ( ereg("<COMMAND1", trim($XMLdata)) ):
print 'xmldata is a command1'
break;
case ( ereg("<COMMAND2", trim($XMLdata)) ):
print 'xmldata is a command2'
break;
default:
print 'no xmldata'
}

But what I'm wondering is whether it is the good way to proceed,
wouldn't it be faster to parse the xml document within php with Expat
library included when it receives a document "<COMMAND idcom="1" />" and
interpret "idcom" value instead of doing an "ereg("<COMMAND1",
trim($XMLdata))?

View Replies !   View Related
XML Parsing!
I've looked and searched and tried to find information about how to solbve this
problem, but I can't. I'm beginning to think that I should start from scratch
to do it right.

I am trying to parse the data from the weather channel in PHP. A slice of the
data looks like this:

<weather ver="2.0">
<cc>
<lsup>3/4/05 8:50 AM Local Time</lsup>
<obst>Vasteras, Sweden</obst>
<tmp>-7</tmp>
<flik>-12</flik>
<t>Mostly Cloudy</t>
<icon>28</icon>
<bar>
<r>1,010.8</r>
<d>steady</d>
</bar>
<wind>
<s>10</s>
<gust>N/A</gust>
<d>180</d>
<t>S</t>
</wind>
<hmid>83</hmid>
<vis>10.0</vis>
<uv>
<i>0</i>
<t>Low</t>
</uv>
<dewp>-9</dewp>
<moon>
<icon>22</icon>
<t>Waning Half, Last Quarter</t>
</moon>
</cc>
</weather>.......

View Replies !   View Related
Looking For Help With RSS Parsing
I'm working on a script to work with podcast feeds (RSS) and have
found the lasRSS parser to be quite good. http://lastrss.webdot.cz/
I've modified this to work with i-tunes tags (as they have added their
own to the RSS vocabulary!) however I still have one set of tags -
category - that I am stuck with.

an example of these tags (Category Technology, Sub Category Computers)
would be:

<ITUNES:CATEGORY TEXT="Technology">
<ITUNES:CATEGORY TEXT="Computers"></ITUNES:CATEGORY>
</ITUNES:CATEGORY>

View Replies !   View Related
Parsing XML?
I have a slight problem with parsing XML:

If the tag was say - <Something ID="12"> - My parser is only retrieving
the 'Something' part, and discarding the 'ID="12"'.

Code:

function startElement($xml_parser, $name, $attrs) {
echo $name; //this is the part with the issue
}

function endElementStuff($xml_parser, $name) {
}

function charData($xml_parser, $data) {
echo $data;
}

$xml_parser = xml_parser_create();
$ml_set_element_handler($xml_parser, "startElement", "endElementStuff");
xml_set_character_data_handler($xml_parser, "charData");
xml_parse($xml_parser, $result, TRUE);
xml_parser_free($xml_parser);

View Replies !   View Related
RDF Parsing
I'm looking for an easy to use and understand RDF parser for PHP. Preferably lightweight if possible. I'm currently trying to get my head around this one.: http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/ are there any others that might be considered to be better quality or easier to use?

View Replies !   View Related
Parsing An XML (same TAG Name)
I am stuck processing an XML file. The problem I am having, is I have the
same TAG name - Url - at the same depth, so the value from the last Url read
in is what get saved. I have tried every option I can think of to put each
URL tag into its own variable, without any luck.

I removed portions of the code that does not affect the outcome (for a
smaller post).
Here's a snippet of the XML, and when the code (below) runs, no matter what,
the value of $items[$itemcount]['url'] is always
/TiVoVideoDetails?id=465887.

- <CustomIcon>
<Url>urn:tivo:image:save-until-i-delete-recording</Url>
<ContentType>image/*</ContentType>
<AcceptsParams>No</AcceptsParams>
</CustomIcon>
- <TiVoVideoDetails>
<Url>/TiVoVideoDetails?id=465887</Url>
<ContentType>text/xml</ContentType>
<AcceptsParams>No</AcceptsParams>
</TiVoVideoDetails>

PHP code:
<?php
class Tivo_XML {
var $dvr;
function parseTiVoXML()
{
global $items;
$this->parser = xml_parser_create();
xml_set_object($this->parser, &$this);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($this->parser, "_tivostart_element",
"_tivoend_element");
xml_set_character_data_handler($this->parser, "_tivodata");
$file = $this->dvr . "_nowplaying.xml";
$tivoxmlstr = file_get_contents ($file);
$tivoxmlstr = str_replace("&amp;", "%amp;%", $tivoxmlstr);
xml_parse($this->parser, $tivoxmlstr , true) or
die (sprintf("XML Error: %s at line %d",
xml_error_string(xml_get_error_code($this->parser)),
xml_get_current_line_number($this->parser)));
xml_parser_free($this->parser);
return $items;
}

View Replies !   View Related
How To See Without Parsing
I am trying to learn some php and sometimes i want to see how other people
do it.
My question is: is there a way for me to view the original unparsed file and
not the result?
If i simply click on it i see the reulting html. I want to see the source.

View Replies !   View Related
PHP 4.0.6 And XML Parsing
I wrote an XML parsing class, and the day that my host upgraded to PHP 4.0.6, my script quit working. At first, I thought XML parsing in general was hosed, but I used a quick XML parsing script and it worked fine. I think I found the issue. Here's what my class looks like: PHP Code:

View Replies !   View Related
Parsing XML With PHP - Not DOM XML
I am not really sure how to parse files with PHP XML other than DOM
XML. Unfortunetely, I have run into a few problems with size and was
told that for the type of parsing I am doing I would be better using
event driven parsing like SAX.

Below I have a simple example of XML similar (although much much
smaller) to the one I am using for real.

XML:

<?xml...
<root>
<name age="25">Martyn</name>
<name age="24">Neil</name>
<name age="24">Robbie</name>
</root>

All I want to do is to output them as:

Martyn (25)
Neil (24)
Robbie (24)

How would I do this uisng something like SAX / EXPAT? I found tutorials
but didnt really understand them enough to know if I was looking up the
correct thing.

View Replies !   View Related
XML Parsing - Help!
I've been following this tutorial and can get it working, but what i want to do is take the data from a dynamic aspx xml file

$xml_file = "http://www.example.com/xml/Search.aspx?make=Ford&model=Accord";

i have downloaded the source of this aspx file and saved it as an xml and I can get it to work.

the error I get when trying to parse the dynamic xml is

"Could not read file"

this tells me so far that it has successfully read this file using 'fopen' but it cannot read it using 'fread'

can anyone shine some light on me on how to successfully parse an aspx xml feed with php?

is it something to do with the values in the url?

View Replies !   View Related
Parsing
in a php script i'm writing, i want to set
$email=fire_juggler_03@hotmail.com.nospam but it doesn't like it. How should
i write the underscores? because i know you have to ' for apostrophes.

View Replies !   View Related
RSS Parsing
I`m making a website that will parse rss from blogs. First i used magpierss but it did`t satisfy me because of those annoyng charsets. Anyway, right now i`m using another parser.

This is my concern:

How to parse all the data from rss including categories and subcategories from blogs. I mean, how to insert in database the categories and subcategories and how to query them? I made the categories and subcategories table in mysql, but how to insert from rss to mysql? When i enter a rss feed to parse, it grabs it all.

View Replies !   View Related
Parsing From Url
I have a quick question i have the user click on http://sometime.com/page.php

I want to send some variables with that url

they are
$objTask->p('eric')
$objTask->p('cuoos')
$objTask->p('clli')

how would I send them with that page?

View Replies !   View Related
Parsing Key/value
I am receiving a response from a post into $response. I need to extract the key/value pairs and format up a new parameter string and send it to another servlet. Can I extract the key/value with something like this?

$response_vars  = (explode '&', $_response)
  $pairvalue = (explode '=', $_response_vars)
  foreach ($pairvalue as $k => $v){
      $data .= $key . '=' . urlencode($value) . '&';
     }

and then use this to execute a well formed url and post it?

 curl_setopt($curl_handle, CURLOPT_URL, "https://mydomain.com/context/myAction.do?");
 curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
  $response_2nd = curl_exec ($curl_handle) or die ("There has been an error connecting");

View Replies !   View Related
CVS Parsing
Php can parse XML file using simplexml. what about CSV file, any function for that?

View Replies !   View Related
Parsing Out This Xml Via Php
is it possible to parse out an xml document that is structured as follows (i did not write this xml file!) :

<gallery>
<album id="3" title="mainpage" description="Zeek's Creek." lgPath="http://site.com" tnPath="" tn="http://site.com/" startHere="">
<img src="zekes creek.jpg" caption="" link="zekes creek.jpg"/>
</album>
</gallery>

so that i can return just the value of the album description via php under the picture? or is this xml file actually not considered a true xml file based on the multiple attributes?

View Replies !   View Related
CV Parsing
I was wondering has anybody come across a tool that parses Curriculum Vitaes? I am looking to integrate a feature into an online recruitment tool that aids shortlisting by parsing CV's. I do not want to reinvent the wheel if something open source is out there or if I can adapt something similar.

View Replies !   View Related
Parsing Xml
So I have this xml parser that works fine and my xml file has this:

<wpt lat="39.6512" lon="-84.147733">
<time>2006-01-24T00:00:00.0000000-08:00</time>
<name>GCZF70</name>

The part in my parser that sets where to look in the structure is:

$xml_name_key = "*GPX*WPT*NAME";When I use the above setting, it works correctly so I know the program works, but how would I get the lat and lon values from the <wpt> tag? I tried *GPX*WPT*LAT also *GPX*WPT:lat *GPX*WPT *GPX*WPT-lat none of them worked, how should I code it properly?

View Replies !   View Related
Parsing URL
What are the sites that you can recommend that talk about parsing URL, because i want to extract information on a website dynamically w/o doing the copy paste thing.

View Replies !   View Related
Parsing CSV And XML
Have a client using a third party sms provider for a competition. The third party can supply me with either csv or xml data.

I have had a go at processing it with CSV and this is simple enough. Just wondering if it is easier with XML although I have never done it before. I have posted the XML file contents below. Code:

View Replies !   View Related
Parsing XML...
I'm writing a class to consume NOAA's weather forecast web service. Issuing the query and receiving the result is easy—it takes two lines of code.

Parsing the result, however, is hard. I've been playing with PHP's built-in XML-parsing functions, but as far as I can tell, none of them can automatically translate a chunk of XML into a nice, neat tree of associative arrays (or something comparably easy to navigate). xml_parse() is really just a lexical analyzer, not a parser, and xml_parse_into_struct() generates an obnoxious parallel array structure.

View Replies !   View Related
CSV Parsing Help
I am working on making an election result page for my website that works off of a CSV database that would be constantly updated throughout election night. I don't know that much PHP, but I learn pretty good as I go along. I'm not sure how to get the CSV file to work with putting certain races on certain pages and certain values in certain areas.

View Replies !   View Related
XML Parsing
I have the current XML file. Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<projects>
<project>
<code>p00001</code>
<name>Test Project</name>
</project>
</projects>

View Replies !   View Related
Validating XML Before Parsing In PHP
Does anyone out there is devshed land know of an easy way to valdiate an XML file before trying to parse it in php.

I generate XML from a variety of sources and sometimes get funky charecters, bad tag names, and empty tags "<></>" and other wierd stuff.

Is there a simple way to check a large xml file (1000k-100,000) before I run my parser on it.

Also, when the built in XML parser hits one of these errors in the it just exits with out returning any usefull error. I could post the code if any one would like to see it, but it is very complicated and poorly documented.

View Replies !   View Related
URL Parsing - Preg_match
I have a url that I would like to parse in a particular manner that I have not quite found on the site or internet how to exactly do. My knowledge and skill with prel reg expressions is limited and I can understand a parsing pattern but i cant quite write my own yet.

What I want to do is take the url for example:

http://somehost.somedomain.toplevel...efile.something

I want to parse it and get the host.domain name, just domain name, and then just the file at the end.

I have tried a few things and gotten the host.domain and just the domain name, but have yet to figure out how to exactly get the file at the end because of the file may have more than a 3 letter extension.

View Replies !   View Related
Array Parsing
I need help parsing an array. all i'm trying to do is run htmlspecialchars() through all the peaces in the array. Dont matter how it gets done just as long as it's done.

View Replies !   View Related
Parsing With Regex
I am trying to parse a block of repeating code that looks like this"

<span class="span1"> Some text </span>
<span class="span2"> Some text </span>
<span class="span3"> Some text </span>

I've tried to extract the first line using of each block using:

eregi("<span class="span1">(.*)</span>", $code, $span1);

The only problem is, it doesn't stop at the first </span> after <span class="span1">. It continues all the way to the last </span> tag. Is there a way to modify the regex to stop at the first </span> tag?

View Replies !   View Related
Excel Parsing
Is there any easy way to parse excel document in php..I have to parse a excel document and display the info in a form ,so the user can edit the excel document.

View Replies !   View Related
Need Help Parsing Php Thru Apache
I had PHP4 working fine thru Apache on a windows ME laptop however, I nanged up and did something odd (in the file association) as now when I try and parse any php documents all I get is the Open with dialog box. What should the correct file associations be as I cant get apache to recognise any php files. Any help greatly appreciated.

View Replies !   View Related
Parsing Files
I encountered the concept of templates and parsing files. For example: sometimes when you search a site, and when you visit links that the engine returned you found your query highlighted inside the text. Very nice. They parsed the file you requested and put some nice formatting around all occurences of your querystring.

I would like to apply it different, more in a sense of:
you enter a URL in the address bar, and this file is parsed before it is shown to you.
An application would be:all e-mail addresses inside the file are replaced by mailto:hyperlinksall static hyperlinks inside the file are replaced by real hyperlinks etc.

A normal php-file at my site looks like:

- php-include (html: header)
- text: html formatted
- php-include (html: footer)

How can I achieve that when this file is loaded all occurences of some kind (stored in an array containing all needles) are handled in some way to show appropriate hyperlink-formatting before it is presented to the user.
(much like a dictionary: words in the text can be references and are explained elsewhere).

It is required that the text stays the same and the file can be loaded stand-alone (without querystrings).

View Replies !   View Related

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