PHP parsing script

Hi,

i need to write a php script parser but i don't really succes to wrote
one and i finaly i don't know how do this !


it seems simple for sure, however my last test was unsuccessfull, just i
want to is :

- read a php or plain text file and store us content to Array

- explode and expand the first Array line by line separing Html tag and
PHP to a Biggest Array, one line for one tag or ";"

- send the new array to a "foreach" or "while" statement and change the
keywords by they equivalent in PHP or Html

- next step, send the PHP code to an eval()


the result was stored or send to the output buffer.


my last try given an "error in eval's code" error, but the same alone
file work really fine without errors

Thank for your suggestions and helps.

Cordialy.
Sebastien.
Sebosac [ So, 29 April 2007 15:39 ] [ ID #1700674 ]

Re: PHP parsing script

On Apr 29, 9:39 am, Sebosac <sebo... [at] wanadoo.fr> wrote:
> Hi,
>
> i need to write a php script parser

Why do you want to write a php script parser? Don't you need a php
parser to parse the php code that you make to parse the other php
code? Isn't there a nice C++ one at php.net?

What are you trying to accomplish by parsing PHP and HTML code?

-Mike PII
sumguyovrthar [ So, 29 April 2007 22:23 ] [ ID #1700676 ]

Re: PHP parsing script

Mike P2 a =E9crit :
> On Apr 29, 9:39 am, Sebosac <sebo... [at] wanadoo.fr> wrote:
>> Hi,
>>
>> i need to write a php script parser
>
> Why do you want to write a php script parser? Don't you need a php
> parser to parse the php code that you make to parse the other php
> code? Isn't there a nice C++ one at php.net?
>
> What are you trying to accomplish by parsing PHP and HTML code?
>
> -Mike PII
>

i wrote a CSM, most page contain keywords inside and without that parser =

my projet is out.
Sebosac [ Mo, 30 April 2007 00:04 ] [ ID #1700677 ]

Re: PHP parsing script

On Apr 29, 9:39 am, Sebosac <sebo... [at] wanadoo.fr> wrote:
> Hi,
>
> i need to write a php script parser

Why do you want to write a php script parser? Don't you need a php
parser to parse the php code that you make to parse the other php
code? Isn't there a nice C++ one at php.net?

What are you trying to accomplish by parsing PHP and HTML code?

-Mike PII
sumguyovrthar [ So, 29 April 2007 22:23 ] [ ID #1700738 ]

Re: PHP parsing script

Mike P2 a =E9crit :
> On Apr 29, 9:39 am, Sebosac <sebo... [at] wanadoo.fr> wrote:
>> Hi,
>>
>> i need to write a php script parser
>
> Why do you want to write a php script parser? Don't you need a php
> parser to parse the php code that you make to parse the other php
> code? Isn't there a nice C++ one at php.net?
>
> What are you trying to accomplish by parsing PHP and HTML code?
>
> -Mike PII
>

i wrote a CSM, most page contain keywords inside and without that parser =

my projet is out.
Sebosac [ Mo, 30 April 2007 00:04 ] [ ID #1700750 ]

Re: PHP parsing script

http://greg.chiaraquartet.net/archives/137-a-parser-generato r-for-PHP-finally.html
http://www.program-transformation.org/PHP/PhpFront

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.

BTW be carefull, using eval may make your app vurnerable to php code
injection.

Sebosac wrote:
> Hi,
>
> i need to write a php script parser but i don't really succes to wrote
> one and i finaly i don't know how do this !
>
>
> it seems simple for sure, however my last test was unsuccessfull, just i
> want to is :
>
> - read a php or plain text file and store us content to Array
>
> - explode and expand the first Array line by line separing Html tag and
> PHP to a Biggest Array, one line for one tag or ";"
>
> - send the new array to a "foreach" or "while" statement and change the
> keywords by they equivalent in PHP or Html
>
> - next step, send the PHP code to an eval()
>
>
> the result was stored or send to the output buffer.
>
>
> my last try given an "error in eval's code" error, but the same alone
> file work really fine without errors
>
> Thank for your suggestions and helps.
>
> Cordialy.
> Sebastien.
Henk Verhoeven [ Mo, 30 April 2007 01:03 ] [ ID #1701316 ]

Re: PHP parsing script

On Apr 29, 11:04 pm, Sebosac <sebo... [at] wanadoo.fr> wrote:
> Mike P2 a =E9crit :
>
> > On Apr 29, 9:39 am, Sebosac <sebo... [at] wanadoo.fr> wrote:
> >> Hi,
>
> >> i need to write a php script parser
>
> > Why do you want to write a php script parser? Don't you need a php
> > parser to parse the php code that you make to parse the other php
> > code? Isn't there a nice C++ one at php.net?
>
> > What are you trying to accomplish by parsing PHP and HTML code?
>
> > -Mike PII
>
> i wrote a CSM, most page contain keywords inside and without that parser
> my projet is out.

sounds a bit like smarty to me, perhaps they can help you!
shimmyshack [ Mo, 30 April 2007 02:04 ] [ ID #1701318 ]

Re: PHP parsing script

shimmyshack a =E9crit :
> On Apr 29, 11:04 pm, Sebosac <sebo... [at] wanadoo.fr> wrote:
>> Mike P2 a =E9crit :
>>
>>> On Apr 29, 9:39 am, Sebosac <sebo... [at] wanadoo.fr> wrote:
>>>> Hi,
>>>> i need to write a php script parser
>>> Why do you want to write a php script parser? Don't you need a php
>>> parser to parse the php code that you make to parse the other php
>>> code? Isn't there a nice C++ one at php.net?
>>> What are you trying to accomplish by parsing PHP and HTML code?
>>> -Mike PII
>> i wrote a CSM, most page contain keywords inside and without that pars=
er
>> my projet is out.
>
> sounds a bit like smarty to me, perhaps they can help you!
>

smarty is more complex that i need and too slow too


i just need a exemple for createe abasic oho scriot oarser, like smarty, =

spip, joomla, and more ones
Sebosac [ Mo, 30 April 2007 03:29 ] [ ID #1701320 ]

Re: PHP parsing script

> Sebosac wrote:
>> Hi,
>>
>> i need to write a php script parser but i don't really succes to wrote
>> one and i finaly i don't know how do this !
>>
>>
>> it seems simple for sure, however my last test was unsuccessfull, just i
>> want to is :
>>
>> - read a php or plain text file and store us content to Array
>>
>> - explode and expand the first Array line by line separing Html tag and
>> PHP to a Biggest Array, one line for one tag or ";"
>>
>> - send the new array to a "foreach" or "while" statement and change the
>> keywords by they equivalent in PHP or Html
>>
>> - next step, send the PHP code to an eval()
>>
>>
>> the result was stored or send to the output buffer.
>>
>>
>> my last try given an "error in eval's code" error, but the same alone
>> file work really fine without errors
>>
>> Thank for your suggestions and helps.
>>
>> Cordialy.
>> Sebastien.

On Mon, 30 Apr 2007 01:03:02 +0200, Henk verhoeven wrote:

> http://greg.chiaraquartet.net/archives/137-a-parser-generato r-for-PHP-finally.html
> http://www.program-transformation.org/PHP/PhpFront
>
> Greetings,
>
> Henk Verhoeven,
> www.phpPeanuts.org.
>
> BTW be carefull, using eval may make your app vurnerable to php code
> injection.
>

[Topposting fixed]
Henk, I've noticed you consistently reply above other people's messages.
Would you be so kind to fix your news agent?

And while I am here, I noticed there's a 't' missing in your email
address. PHPPeanuts without it just sounds errm... Well, you get my drift ;-)

KR,
Sh.
Schraalhans Keukenmee[8] [ Mo, 30 April 2007 10:36 ] [ ID #1701327 ]

Re: PHP parsing script

http://greg.chiaraquartet.net/archives/137-a-parser-generato r-for-PHP-finally.html
http://www.program-transformation.org/PHP/PhpFront

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.

BTW be carefull, using eval may make your app vurnerable to php code
injection.

Sebosac wrote:
> Hi,
>
> i need to write a php script parser but i don't really succes to wrote
> one and i finaly i don't know how do this !
>
>
> it seems simple for sure, however my last test was unsuccessfull, just i
> want to is :
>
> - read a php or plain text file and store us content to Array
>
> - explode and expand the first Array line by line separing Html tag and
> PHP to a Biggest Array, one line for one tag or ";"
>
> - send the new array to a "foreach" or "while" statement and change the
> keywords by they equivalent in PHP or Html
>
> - next step, send the PHP code to an eval()
>
>
> the result was stored or send to the output buffer.
>
>
> my last try given an "error in eval's code" error, but the same alone
> file work really fine without errors
>
> Thank for your suggestions and helps.
>
> Cordialy.
> Sebastien.
Henk Verhoeven [ Mo, 30 April 2007 01:03 ] [ ID #1701354 ]

Re: PHP parsing script

On Apr 29, 11:04 pm, Sebosac <sebo... [at] wanadoo.fr> wrote:
> Mike P2 a =E9crit :
>
> > On Apr 29, 9:39 am, Sebosac <sebo... [at] wanadoo.fr> wrote:
> >> Hi,
>
> >> i need to write a php script parser
>
> > Why do you want to write a php script parser? Don't you need a php
> > parser to parse the php code that you make to parse the other php
> > code? Isn't there a nice C++ one at php.net?
>
> > What are you trying to accomplish by parsing PHP and HTML code?
>
> > -Mike PII
>
> i wrote a CSM, most page contain keywords inside and without that parser
> my projet is out.

sounds a bit like smarty to me, perhaps they can help you!
shimmyshack [ Mo, 30 April 2007 02:04 ] [ ID #1701359 ]

Re: PHP parsing script

shimmyshack a =E9crit :
> On Apr 29, 11:04 pm, Sebosac <sebo... [at] wanadoo.fr> wrote:
>> Mike P2 a =E9crit :
>>
>>> On Apr 29, 9:39 am, Sebosac <sebo... [at] wanadoo.fr> wrote:
>>>> Hi,
>>>> i need to write a php script parser
>>> Why do you want to write a php script parser? Don't you need a php
>>> parser to parse the php code that you make to parse the other php
>>> code? Isn't there a nice C++ one at php.net?
>>> What are you trying to accomplish by parsing PHP and HTML code?
>>> -Mike PII
>> i wrote a CSM, most page contain keywords inside and without that pars=
er
>> my projet is out.
>
> sounds a bit like smarty to me, perhaps they can help you!
>

smarty is more complex that i need and too slow too


i just need a exemple for createe abasic oho scriot oarser, like smarty, =

spip, joomla, and more ones
Sebosac [ Mo, 30 April 2007 03:29 ] [ ID #1701362 ]

Re: PHP parsing script

On 29.04.2007 15:39 Sebosac wrote:
> Hi,
>
> i need to write a php script parser but i don't really succes to wrote
> one and i finaly i don't know how do this !

Well, to write a php parser you first need a parser generator like yacc
or bison. I'm not aware of any one that is able to generate php code,
but try googling "php parser generator". When you get the parser, write
the php grammar for it (or adapt zend_language_parser.y from php
sources). Fill your grammar with appropriate actions and run the
generator. That's basically all about this.


--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
gosha bine [ Mo, 30 April 2007 10:20 ] [ ID #1701384 ]

Re: PHP parsing script

> Sebosac wrote:
>> Hi,
>>
>> i need to write a php script parser but i don't really succes to wrote
>> one and i finaly i don't know how do this !
>>
>>
>> it seems simple for sure, however my last test was unsuccessfull, just i
>> want to is :
>>
>> - read a php or plain text file and store us content to Array
>>
>> - explode and expand the first Array line by line separing Html tag and
>> PHP to a Biggest Array, one line for one tag or ";"
>>
>> - send the new array to a "foreach" or "while" statement and change the
>> keywords by they equivalent in PHP or Html
>>
>> - next step, send the PHP code to an eval()
>>
>>
>> the result was stored or send to the output buffer.
>>
>>
>> my last try given an "error in eval's code" error, but the same alone
>> file work really fine without errors
>>
>> Thank for your suggestions and helps.
>>
>> Cordialy.
>> Sebastien.

On Mon, 30 Apr 2007 01:03:02 +0200, Henk verhoeven wrote:

> http://greg.chiaraquartet.net/archives/137-a-parser-generato r-for-PHP-finally.html
> http://www.program-transformation.org/PHP/PhpFront
>
> Greetings,
>
> Henk Verhoeven,
> www.phpPeanuts.org.
>
> BTW be carefull, using eval may make your app vurnerable to php code
> injection.
>

[Topposting fixed]
Henk, I've noticed you consistently reply above other people's messages.
Would you be so kind to fix your news agent?

And while I am here, I noticed there's a 't' missing in your email
address. PHPPeanuts without it just sounds errm... Well, you get my drift ;-)

KR,
Sh.
Schraalhans Keukenmee[8] [ Mo, 30 April 2007 10:36 ] [ ID #1701387 ]

Re: PHP parsing script

gosha bine wrote:

> Well, to write a php parser you first need a parser generator like yacc
> or bison.

Well no, you don't *need* to, though it would make things easier.

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Toby A Inkster [ Mo, 30 April 2007 14:27 ] [ ID #1701412 ]

Re: PHP parsing script

On 30.04.2007 14:27 Toby A Inkster wrote:
> gosha bine wrote:
>
>> Well, to write a php parser you first need a parser generator like yacc
>> or bison.
>
> Well no, you don't *need* to, though it would make things easier.
>

Well of course you *can* put it together yourself, but I'd only
recommend that if you have absolutely nothing better to do.

--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
gosha bine [ Mo, 30 April 2007 15:58 ] [ ID #1701424 ]

Re: PHP parsing script

On 30 Kwi, 15:58, gosha bine <stereof... [at] gmail.com> wrote:
> On 30.04.2007 14:27 Toby A Inkster wrote:
>
> > gosha bine wrote:
>
> >> Well, to write aphpparser you first need a parser generator like yacc
> >> or bison.
>
> > Well no, you don't *need* to, though it would make things easier.
>
> Well of course you *can* put it together yourself, but I'd only
> recommend that if you have absolutely nothing better to do.
>
> --
> gosha bine
>
> extendedphpparser ~http://code.google.com/p/pihipi
> blok ~http://www.tagarga.com/blok

you can download php grammar for visual bnf parser from www.intralogic.eu
adams7807 [ Do, 28 Juni 2007 10:46 ] [ ID #1753698 ]
PHP » alt.php » PHP parsing script

Vorheriges Thema: get image size from binary data
Nächstes Thema: using wget and cron -- a simple test failed...?