Thread: php in python

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2005
    Location
    NIPPON
    Posts
    15
    Rep Power
    0

    php in python


    hello.

    Is there any way you can use php within python ?

    not like this though.
    os.popen("php your.php " )

    i am looking for a way to import some module that is
    written in php.

    i found a similar things can be done with perl using pyperl
    module from CPAN , but when it comes to php, it seems
    not possible.

    thanks in advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    461
    Rep Power
    25
    php really isn't a good scripting lang. acutally it is horible for it. If you are trying to do this for a web site. Then i really don't know if there is a away. I don't think there would be tho, because of the uslessness of php command scripting lang, its only good for web sites.
  4. #3
  5. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    I try to avoid saying something isn't possible but on this one I think it might be – unless you want to sit down and write something to do it. Both languages can be used on the web so it is possible for the two too interact i.e. one page can send parameters to another regardless of language.

    In any case I wouldn't use PHP from Python anyway, even if it possible it's probably more trouble than its worth. As Cyber said "PHP really isn't a good scripting lang."

    What do these PHP modules you want to use do? In all likeliness there is probably similar for Python. Also, what are you trying to do?

    Hope this helps,

    Mark.
    programming language development: www.netytan.com – Hula

  6. #4
  7. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    Originally Posted by CyBerHigh
    php really isn't a good scripting lang. acutally it is horible for it. If you are trying to do this for a web site. Then i really don't know if there is a away. I don't think there would be tho, because of the uslessness of php command scripting lang, its only good for web sites.
    when users who say such things like that they really mean "I hate php because im not good at it, in fact im going bold because i dont even under stand how to create a pagenation in php, geez im such a lamer!!"
  8. #5
  9. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Originally Posted by xlordt
    when users who say such things like that they really mean "I hate php because im not good at it, in fact im going bold because i dont even under stand how to create a pagenation in php, geez im such a lamer!!"
    Lets all please do our very best not to let this thread burst into a flames . One post has already had to be deleted.

    Anyway, where I do agree with some of what you have said X I don't think it's always the case. I'm quite proficient in PHP – or used to be. I haven't used PHP in around a year – but I still don't think it makes a good scripting-language. On the web though it's not half bad .

    All in all I'm not a huge fan of PHP anymore, but I can appreciate its merits .

    Take care guys,

    Mark.
    programming language development: www.netytan.com – Hula

  10. #6
  11. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    Originally Posted by netytan
    Lets all please do our very best not to let this thread burst into a flames . One post has already had to be deleted.

    Anyway, where I do agree with some of what you have said X I don't think it's always the case. I'm quite proficient in PHP – or used to be. I haven't used PHP in around a year – but I still don't think it makes a good scripting-language. On the web though it's not half bad .

    All in all I'm not a huge fan of PHP anymore, but I can appreciate its merits .

    Take care guys,

    Mark.
    someone wants to die tonight you know i hate it when users try to degrade other langs, btw sup sup.. its been a while
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2005
    Location
    NIPPON
    Posts
    15
    Rep Power
    0
    Originally Posted by netytan
    I try to avoid saying something isn't possible but on this one I think it might be – unless you want to sit down and write something to do it. Both languages can be used on the web so it is possible for the two too interact i.e. one page can send parameters to another regardless of language.

    In any case I wouldn't use PHP from Python anyway, even if it possible it's probably more trouble than its worth. As Cyber said "PHP really isn't a good scripting lang."

    What do these PHP modules you want to use do? In all likeliness there is probably similar for Python. Also, what are you trying to do?

    Hope this helps,

    Mark.
    This is the reason why i want to calll php from Python.
    Currently i am developing some appli using FAST which is
    some 3rd party search engine which uses Python to do some
    work with html or other documents. These datas extracted
    from html files are stored in Python struct and needed to
    access to them using some other language .
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    461
    Rep Power
    25
    sorry, i was by no means down grading php, I am actually very good with php. It is just really no good for a scripting lang. It is great at what it is for, web deveopment. It is still not very good for making quick scripts.

    sorry, i wasn't trying to start a flame war or anything, I was just pointing out that if that is what he was trying to do, then he should probably reconsider.

    But what for what your trying to do, i think the best way is to just have it sent to the php or to the python page via get or post. That would probably the simplist. Or you could always store to a file or a db possible.
  16. #9
  17. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Originally Posted by oppai
    This is the reason why i want to calll php from Python.
    Currently i am developing some appli using FAST which is
    some 3rd party search engine which uses Python to do some
    work with html or other documents. These datas extracted
    from html files are stored in Python struct and needed to
    access to them using some other language .
    If the dates are actually stored in the Python file then you should be able to import it from another Python program.

    Note: This may produce some odd effects if the program runs anything outside of an if __name__ == '__main__' block so you might want to check that out.

    This means that by importing the Python file you will have full access to all of the data structures hiding within it, so you can make them available to PHP in any number of ways i.e. though MySQL or SOAP .

    On the other hand, if the dates are being stored in a file (which it doesn't seem like it does from your post) then even better because it means you can use the dates directly from PHP.

    Mark .
    programming language development: www.netytan.com – Hula

  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2005
    Location
    NIPPON
    Posts
    15
    Rep Power
    0
    Originally Posted by netytan
    If the dates are actually stored in the Python file then you should be able to import it from another Python program.

    Note: This may produce some odd effects if the program runs anything outside of an if __name__ == '__main__' block so you might want to check that out.

    This means that by importing the Python file you will have full access to all of the data structures hiding within it, so you can make them available to PHP in any number of ways i.e. though MySQL or SOAP .

    On the other hand, if the dates are being stored in a file (which it doesn't seem like it does from your post) then even better because it means you can use the dates directly from PHP.

    Mark .
    Thanks for your insight. i thought about storing the data in the file, though i wanted to avoid it. But i guess coming up
    with other alternative might be a time consuming.
    so thank you.
  20. #11
  21. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    Originally Posted by CyBerHigh
    sorry, i was by no means down grading php, I am actually very good with php. It is just really no good for a scripting lang. It is great at what it is for, web deveopment. It is still not very good for making quick scripts.

    sorry, i wasn't trying to start a flame war or anything, I was just pointing out that if that is what he was trying to do, then he should probably reconsider.

    But what for what your trying to do, i think the best way is to just have it sent to the php or to the python page via get or post. That would probably the simplist. Or you could always store to a file or a db possible.
    NO BIGGIE, i think all lang sux... what rox is what you make of it ( did i just contradict my self ). Also dont listen to netytan he is mentaly confused.. though he is one of my best buddy here on dev ( i just hate him because he got his notebook before i did )
  22. #12
  23. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Originally Posted by xlordt
    NO BIGGIE, i think all lang sux... what rox is what you make of it ( did i just contradict my self ). Also dont listen to netytan he is mentaly confused.. though he is one of my best buddy here on dev ( i just hate him because he got his notebook before i did )
    LOL I'm not the only one confused . Got a notebook now then? Anyway X drop me an email when you can, like you said it's been a while. BTW I was checking out your site the other day .

    Cyber: don’t worry about it. If we can't express our opinions freely then it's just no fun. Besides you made a good point if you ask me .

    Later guys,

    Mark.
    programming language development: www.netytan.com – Hula

  24. #13
  25. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    Originally Posted by netytan
    LOL I'm not the only one confused . Got a notebook now then? Anyway X drop me an email when you can, like you said it's been a while. BTW I was checking out your site the other day .

    Cyber: don’t worry about it. If we can't express our opinions freely then it's just no fun. Besides you made a good point if you ask me .

    Later guys,

    Mark.
    i cant im still offline.. im on now because im at work... i owh $143.00 to the cable company.. but i should be back no longer then a month or so but i promise i will drop you an email then or see you on msn... btw.... you know how i feel about php.. so dont make me go up there and kick your @$$
  26. #14
  27. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Originally Posted by xlordt
    i cant im still offline.. im on now because im at work... i owh $143.00 to the cable company.. but i should be back no longer then a month or so but i promise i will drop you an email then or see you on msn... btw.... you know how i feel about php.. so dont make me go up there and kick your @$$
    Oh how I'd like to see that happen . Anyway I'll catch you around sometime I'm sure.

    Take care X,

    Mark .
    programming language development: www.netytan.com – Hula


IMN logo majestic logo threadwatch logo seochat tools logo