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.





Easy PHP+XML Parser


I have data like:

<?xml version="1.0" encoding="ISO-8859-2"?>
<news>
<post>
<date>10.04.2004</date>
<text>Test test test</text>
</post>
<post>
<date>15.04.2004</date>
<text>Bleh bleh bleh <a href="www.test">test</a></text>
</post>
</news>

and I want to have it in PHP as array looking like:

array(
[0] =>
array(
date => "10.04.2004"
text => "Test test test"
)
[1] =>
array (
date => "15.04.2004"
text => "Bleh bleh bleh <a href="www.test">test</a>"
)
)

problem - text can have some HTML tags, so I want to just have it all in
string.

How can I do this in PHP if I have XML data in some data.xml ?




View Complete Forum Thread with Replies

Related Forum Messages:
Easy Form Mailer That Is Clean Looking And Easy To Edit.
I have been looking for really easy form mailer that is clean looking and easy to edit. I also am looking for required fields, ect. I have looked all over hotscripts and I really cant find what i'm looking for, anyone else have an idea where i can find what i'm lookin for?

View Replies !
Easy Easy Question (Field Type)
I have built a little MySQL / PHP forum, and was wandering how to incresae the storage of the main message from 255 characters to a lot more, which field type am I after?


View Replies !
This Should Be Easy
When the form is submitted I want to do different things depending on if there is anything in the "image" field or not. I was thinking this would be a simple.

View Replies !
OK This Is An Easy One For Someone!
I'm sooo new to this, but so far i have managed to create a form (like a
shopping list) in one page which looks like this where i can put quantities
in on one page.

Then it passes the form info onto my next page which displays a list and
totals. But how, pray, would I make it miss out items on my second page
where they have a value on null? You see I would rather just have the items
where I have actually given a value! Is it some kind of if else statement
possibly followed by the ! mark to reverse the flag or summat?

View Replies !
This Should Be Easy, But...
I'm trying to build a simple, one-dimensional array of prices, where the key
to each element is the product code.

So I start by executing a select query "SELECT Code, Price FROM Products",
and the results are returned in a two-dimensional array, $data, which I can
loop through like this:

while (list(, $value) = each($data))
{
$code = $value[0];
$price = $value[1];

I would have thought I could build my array here by writing something like:

$command = "$arr['$code'] = $price;";
exec($command);

But this doesn't work.

View Replies !
Is There An Easy Way To Do This?
I don't even know where this question classifies itself but hopefully someone can point me in the right direction:

If i have a list as such:

-NHL
-MLB
-NBA
-NFL

Is there a way to have an option like an 'onclick' where each item that is clicked gives a variable such as $clickedvalue the value of the item clicked while at the same time, routing to a function in separate php file?

1) So let's say i clicked on MLB
2) the variable $clickedvalue = item clicked (in this case MLB)
3) call a function in a separate php file for processing..
4) return to main script.

so far i know of the href=# but with it, i can't really give my variable a value.

View Replies !
Easy PHP
Im trying to send a variable via GET to a php script like so:

<a href="process.php?id=test & test">Link</a>

Leaving spaces is no problem, but the & symbol (ampersand) cannot be displayed to the screen. I want it to show "test & test". Instead it displays just "test" without the rest following it. how to display the whole variable passed to process.php?

View Replies !
Easy CMS
I am looking for a very basic CMS with user authentification... I get stuck on how to make multiple admins <b>without</b> doing something like :

$admin = 1
$member = 0

type of stuff...
What is another way to make different levels of membership?

View Replies !
Calculating Tim - Easy For You! =)
I found out that i can calculate the dates e.g

$today = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d"),
date("Y")));
$yesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d") - 1,
date("Y")));
$dayBeforeYesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"),
date("d") - 2, date("Y")));
$dayBeforeTheDayBeforeYesterday = strftime('%Y%m%d',mktime(0, 0, 0,
date("m"), date("d") - 2, date("Y")));

and so on........

This works even if we have the 1st of August $yesterday gives me the 31st
july.

Can I do this with times also?

e.g. Iit it now 17:06 an i want to make minus 20 min (like abopve minus 1
day) and I want the result to be 16:46.
I tried the above example, wit %H%M but it does not work?

View Replies !
Headers Seem To Easy!
when running this code:

<html>
<?php
/* This will give an error. Note the output
* above, which is before the header() call */
header('Location: http://www.example.com/');
?>

It runs perfectly on my server! Why isnt is giving the expected error?

View Replies !
ISO An Easy CMS For A Non Programmer..
I need to add a shopping cart and access controlled forum to my
website. Im windows based and I'd like to use php and mysql. Im not a
programmer so I'd like to find a very easy to use CMS, any ideas?

View Replies !
Easy If....question
I need to create a table of 4 columns x n rows. The number of row will
depend on the number of images for that specific page.

I think that I have to use de mod function saying that if (number of
image mod 4 equal 0 then start another row)

Well....first thing...I find the function fmod in the help that I
think that will be useful.

I wrote this small code, but it does not work

while($row = mysql_fetch_array($respuesta))
{
echo('<td width=15% align="center"><img src=" ' .$row["url"]. '
"></td>');
$i++;
if (fmod ($i,4)==0)
{
<tr>
}
}

View Replies !
Easy Tutorials
i ve been told that i need to learn some php in order to get a certain job and point me to a website with some easy php tutorials to get me started.

View Replies !
Easy Editing
I have made a website for someone who doesnt know much about html, so i thought id make a site that the admin can log into, and change things around with tables. I understand what is needed.. but I keep missing things. I have made the password, and the form, does anyone know of a guide on the net?

View Replies !
Easy Preg_replace
if I have a set of words:

211x
122x
213x
asdsax
asdsbx
ascssx
assddx

I would like to only delete the letter x from the word if it is followed before by a number. but, I do not want to delete the numbers, nor do I want to delete the x if it is followed before by a letter.

My plan is preg_replace('/[0-9]*x/' ,'',$string) but it does not seem to work.

View Replies !
Easy Math
How can I add a number up when I am in a while()? Lets say that there are 4 entries for $myrow[0]. 10, 20, 30 and 40. The total of those numbers is 100 right? So how do I output that? PHP Code:

$result = mysql_query("SELECT * FROM yada  ORDER BY id DESC",$db);
while ($myrow = mysql_fetch_row($result)) { 
    
    $totalofmyrow = $myrow[0] + itself?????
}

echo $totalofmyrow;

View Replies !
Easy Peasy
I have an idea of code of what I want, just wondering what the real thing may look like, and if it would work. The code below goes in header.php, and in index.php $adloader is defined as 1, or not defined at all;

<? If $adloader = "1";
require("ad1.php");
Else
require("ad2.php");
?>

View Replies !
Easy Updates
I am building a website for a friend who is opening a business selling used vehicles. He would like to take a picture or two of a vehicle and display all of his vehicles on his site. Here's the catch. He knows basically NOTHING about computers. Sending email and browsing the web is about all he knows, and expecting him to be able to FTP images and edit html/php etc. is asking way too much.

I was thinking I'd use MySQL and PHP, and build an "Admin" section of the site for him where he would simply click a "Add Vehicle" button, enter the info, browse to the pic(s) and click submit. The page would write the corresponding entry into the database. I have 2 questions: 1. Is this the correct way to go about this? 2. If yes, can someone point me to a good tutorial for uploading and storing images in MySQL?

View Replies !
The PHP XML-parser Doesn't Like &lt; Or &gt; ??
I'm using PHP's SAX parser to parse an XML file and display it as a chat-style application.

However, to prevent people posting tags, I'm using htmlspecialchars() to convert <, > and ". These go into an XML document fine.

Once it comes to parsing, the parser seems to interpret < and > as actual XML tags though, and it messes up everything. Is this a known bug, or is there a way of combatting it?

View Replies !
Php-xml Parser
I have a PHP script which sends a authorisation request to a Servlet and receives a response in XML format. I have also created a parser (using both DOM as well as SAX) for parsing the output.

My problem: The parser takes in input from an external xml file but the output from the servlet needs to be dynamically fed into the parser something like this: PHP Code:

View Replies !
Php Parser
I like to know wheter it is possible with php to do the following
taskes:
- read a file (.txt, .doc, .pdf, ...) word by word to chek if a word
or a sentencs exists...
- chek the form of presentation of a word i.e. chek if the word is
bold, in which size, is it centered or aligned to left,...

View Replies !
PDF Parser
i am trying to make a PDF parser in PHP which will be able to extract
data from PDF files. i want to basically convert pdf files to XML
data. any idea from where i could start?

View Replies !
XML Parser
I have a very complex xml doc which if convert into array gives you a lot of nested array.
i wanted some good parser which would parse this complex xml data.
any idea about a good parser or code..which would work on php 4.4.4
I want to extract values from one offset tag and get those extracted values to the DB.

View Replies !
Rss Parser
im using this script that somebody else has made. well some feeds work just fine, some feeds end up with nothing in the item array at all and some feeds come up with this fopen error. Code:

View Replies !
DOM XML Parser
Can we parse Xhtml file using DOM XML parser of PHP. What i really want is this, I have an xhtml file and i want to edit/delete some of the contents in that xhtml file. Xhtml file is organized into parts using <div> tags. this is how it looks like,

<div id="book1">
this is the book introduction part.
<div id="part1">
This is the part introduction
<div id="sec1">
This is the section intrduction
<div id="subSec1">This is the sub section introduction</div>
</div>
</div>
</div>

now what i want is to get the contents that resides inside the <div> tag and edit / delete that content. Which <div> tag to choose, is depending on the parameter i passes and the parameter i pass to the script will hold the <div> id . So according to that i know which <div> tag to choose. Can i do this using XML parser.

View Replies !
Parser
can anyone give me a good defination of a parser, (ive used it to take text from one website and put it into another) but i need some background knowledge of the workings of a parser etc.

View Replies !
Parser?
I am in the process of creating a parser, the following is the code i have started with:

<?php
/*  &copy; MMVI weiqiang's minisite productions
    This programme is intented to be used only on weiqiang's minisite,and no unauthorised usage is allowed.
    You may use the programme if only granted permission by the author.
    Programme filename: manager.php
    Programme function:
    Programme authorised to: Original Copy(weiqiang's minisite)
*/
/*Start Of Programme*/
function parsedocument($document,$returnview=null){
    //document is with regards to root folder
    if(stristr($document,'.php')){
        $handle = fopen($document, "r");
        $contents = fread($handle, filesize($document));
        fclose($handle);
        sprintf($contents);
        preg_replace("{title}","$title",$content);
    }
    /*elseif(!stristr($document,'.php')){
        die(error_note(1010));
        return false;
    }*/
}
parsedocument('bbcode.php');
?>

But i am having a problem of "printing" out the final code
as print() does not support anything other than variable,html and characters right?I mean it doesn't suppot those "<?php" and "?>".

View Replies !
SQL Parser
IS there a script out there in PHP that can run over a simple SQL statement a report in plain english what it will do? E.g.

Updating data in company table
name is now xxx
date is now xxx.

View Replies !
How To Use My Own Parser?
My web host's PHP doesn't provide curl, so I want to run .php files thru my own PHP parser. However, I don't want to rename all the .php files into .cgi files and add some #!/path/to/php as the first line. Code:

View Replies !
Best Xml Parser
I need to use some Ajax for a site running PHP, I was wondering which
is the best xml parser to use?

View Replies !
Css Parser
is there any reason for this script not to work? after trying various ways of reading in the css files for some reason all im getting is the echo statements at the bottom. Code:

View Replies !
How To Get Page Title, In Not An Easy Way
ok, here is the situation

i have included header.php into index file but
i have this in index.php:
[php]
switch($_GET['action']) {
case 'page':
$pages[0] = "news0.php";
$pages[1] = "news1.php";
.
.

if ($_GET['page'] != "") {
$to_include = $_GET['page'];
include ($pages[$to_include]);
}
break;
default:
include("news.php");
[php]


i tried all sort off stuff like implode, pregmatch,ordinary passing $title variable, $_PHPSELF, and nothing seems to be working.

all i want to do is to get title like domain.com-news.

can anybody give me a tip what should i do?

View Replies !
Which Prog To Use For An Easy Install?
I am using PHP in my windows environment which i installed phptriad but phptriad supports php 4.1.1 and I want to use GD2 library and also everyone know the super globals are off in the 4.2+ verisons of PHP. I redownload the phptriad from sourceforge but they didn't upgrade the version of PHP it is still 4.1.1 so i search a bit and found easyPHP which has a french installation and i have no french. But i installed the easyPHP to the folder C:EASYPHP but not working now and i couldn't start the sql and apache server after several tries. So anybody have an idea for what to do? or a program to suggest which is as good as phptriad but supports 4.2?

View Replies !
Booleans And Functions (easy...)
Can a function return a boolean (true/false) that could then be directly used in a conditional loop ?

E.g. for the moment I use the following function :

function Check(...) {
$q = mysql_query("select ... from ... where ...");
if(mysql_numrows($q) == 1) { return 1; }
else { return 0; }
}

and further on :

if (Check() == 1) { ... } else { ... }

Can't I get anything that would allow me to do :

if (Check()) { ... } else { ... }

View Replies !
Debugging Scripts The Easy Way.
i found some ways to debug scripts like useing the error_reporting( E_ALL );
which will display any small bugs in your script and give you a warning about them.

but the most common of them is ones like this:

Warning: Use of undefined constant _jobdepartment - assumed '_jobdepartment' in c:foxservwww\_roguemodulesphprofessionadminindex.php on line 82
Warning: Use of undefined constant _joblisting - assumed '_joblisting' in c:foxservwww\_roguemodulesphprofessionadminindex.php on line 82

the line to fix is this: PHP Code:

View Replies !
Easy Ereg() Question
I'm trying to make sure a form has only one or two digits in either of
two fields. I looked at php.net and ..

http://www.regular-expressions.info/reference.html

and this is what I put together, but while it successfully refuses any non-digit, it still lets any number of digits through.

Any suggestions?

if ((ereg("([0-9]{1,2})", $people))&&(ereg("([0-9]{1,2})", $rooms))) {

View Replies !
Easy Php1-8 Problem
i have installed easy php1-8 on my windows xp machine. Installation was
successfully.
But when i try to run a simple php script:
<?php
phpinfo();
?>

i browser displays the code itself. it is not showing the output.

i have started the apache web server and is running.

View Replies !
Easy Question: How To Know The ID Of A New Record?
I have the following problem.

I am adding a new record in a table.
How can I know the ID provided by the database of the new record?

suppose my table has 3 attributes:
* ID: automatically calculated by the DB server when adding a new record
* Val1
* Val2

I am using the Microsoft SQL server DB and the following code:
$conn=......
$q="insert into t_mytable values ('value1','value2')";
$result=odbc_exec($conn, $q) or die("".odbc_errormsg());

Now I need to send an email with the ID of this record, but I have an error
when I do this:
echo odbc_result($result ,"ID");
here is the error:
Warning: No tuples available at this result index

So I can't get the ID, even if the new record has successfully been added in
the db!!
Actually, I can't get any values of the new field.

Do you have any idea??
Is there another way to know the ID of a new record?

View Replies !
Easy Array Question
Is there a built-in function that checks to see whether or not all the keys in an array are empty/null. ie does this: PHP Code:

View Replies !
Dividing PHP And HTML - Maybe Easy
Summary:
Best way to divide out the HTML and PHP in some code I inherited. How can I
keep the HTML files separate?

Full Details:
I've now been working two weeks on PHP / MySQL code I inherited and the
client is a happy bunny. This was my first crash course outing with PHP, but
with basic PERL experience found it fairly easy to pick up and used the code
I inherited as my guide.

However, the current code has every page as being top half php, bottom half
HTML (with some embedded PHP where necessary)

Eg.
START OF FILE
<?php

do some general processing to set up variables
?>

<HR>

<!--HTML CODE-->
<!-- note that the current code does not even output a HTML HEAD tag - any
reason why this might be?--?
<? occasional bit of PHP ?>
<P>
End of HTML
END OF FILE

The HTML pages are ugly and they have very much hard coded formatting
information in them.
Hence the application is entire need of an overall.

What is the best way to approach this?
I really would like to keep the HTML parts in another file so they could be
editing in programs like dreamweaver to be honest. I obviously want to role
out the use of CSS so that I can change the look and feel quickly.

Is there a command in PHP that when the main processing is done you can
reference another file which contains HTML to be displayed but none of the
current variable information is lost.
I say this because if I use the header(location:) command I have to repost
the form variables which is pain.

Ideally I could just have the main PHP bit in the code, and when it is done
it references a HTML page that is displayed(That HTML page may contain
snippets of PHP). So functionally things still work as they are, but it lets
me put the HTML in a physically different file.

I hope this makes sense.

View Replies !
Easy Webpage Edit
I'm completely new to PHP, and have just one thing that needs to be done.  I do plan on eventually learning PHP, but for now, I need this.

I'm a Visual Basic programmer, and am making a program that will enter data into a website.  I do own the website, however I want the site to update (add the entered data to the bottom of the page) the page as soon as it is submitted.

Basically, I need a script that will add a string of text (entered in an on page textbox) to the bottom of the site.

With this, I plan on duplicating the post data in my program so that I can do this automatically to my website.

View Replies !
How Easy Is It To Add A Delete Function
I have now managed to get the script to display all records, but I can't get it to delete any records.  The edit works fine but can someone show me how to add a delete button as well so that I can delete the one chosen with the current id please. Code:

View Replies !
Writing Easy Script
Use a regular HTML page and form (I plan to have this in a small box on all my HTML pages) to submit the information: Username and Password

It will then check the username against like a csv table (or a txt file, or MySQL) and see where the destination is. Last of all it would go to the following url:
http://username:password@destination

So if we have John Doe visit my site he types in:

Username: johndoe
Password: secret

It then checks the table and sees that the user johndoe has a destination of "thetechturf.com/members/shg38 Last of all it sends him to the page:
http://johndoe:secret@thetechturf.com/members/sgh38

View Replies !
Form Validation :: Easy Way Of Doing?
I wanted an easy way to validate my forms in php. I didn't want to write tons of if loops and stuff each page since I have a ton of forms and stuff on the site I am making. So I decided to make a class based approach.

What I am really looking for is just feedback on the method that I've used. See if there was a better way to do things. Right now it registers a rule into an array and then the check function goes through all the rules to see if the form is valid or not, and then the errors are output if the validation fails. Code:

View Replies !
Is There An Easy Way To Convert Data To Xml In PHP?
MY application gets input data from files in the following fomats:

- xml format 1
- xml format 2
- csv

These should get converted to my defined xml format

2. An example scenario

- Incoming data has an element custId. My application has a matching element customerid.

Is the following solution right or is there a better way?
- create xsd of my final format (is there any available feature or code for this in PHP? Code:

View Replies !
Easy To Use Event Calendar
I am looking to add even calenders to our internal website. I know there are lots of them out there so which one should I install? Here are the features I need? Multiple calendars, password protect calendars, simple to use. Not over inflated with features.

View Replies !
Any Easy Way To Analize Log Files
I'm wondering if there is an easy way to analize log files in php?
I'm sure there is a program somethere on the internet. If anyone can
point me to one it would be great.

I have a log file which contains regular entries as well as some XML
formatted info.

I need XML formatted stuff. Is there an easy way to pull xml data from
this file and process it?

View Replies !
Easy Reference Number
I have a booking page, but want to give people a reference number. I manage to put the Name, and the last 3 digits of their tel number as a ref, but it really work for me.
Is there a easy method of giving reference number?

View Replies !
Easy Date() Question
How would I write "between May 22nd and September 4th" with PHP's date() function? I want to use an if() statement to see if the date is within these paramaters, then echo text based on that. I just don't know how to say that with date().

View Replies !
Easy Date Question
i'm pulling a lot fo dates out a database were the stored as Nov 20 1965 in 3 separate fields (there not in a date field because a lot of times i'm only working with 1 of them, or using them in the WHERE clause as only month or only day).

anyway my question is how do i easy convert something like Nov to 10, the date function in php seems only capable of handling it when there is a time stamp. is there a php function i can make say hey Nov = 10?

View Replies !
Time Worked On Easy But Not Now
When i started to build my site I used easyPHP. For those of you who dont know what easyPHP is, its basically Apache, mySQL and PHP all in one.

I've now bought the domain, webspace etc and somethings now not working correctly The trouble i am getting is that if i had a simple query such as:

$result = mysql_query("SELECT DATE_FORMAT(timeadded, '%H:%i) AS time1 FROM bands", $connection);
$row = mysql_fetch_array($result);
$timeadded = $row['time1'];
echo $timeadded;

If would work on easyPHP but it doesnt work now :-S $timeadded is empty. I've checked the database and theres definitely a value in there.

This problem is only occuring on the time. Its fine with dates etc.

View Replies !
Easy Way To Create Breadcrumbs
I'm trying to think of an easy way to create breadcrumbs similar to this site when you have PHPBuilder.com > PHP Help > Coding and so forth. For some reason I can't think of a way to start this or an easy way to do it. It doesn't seem like it would be the difficult to make it dynamic.

View Replies !

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