call 3rd party extensions func from PHP extension

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Qwaygon
    New Member
    • Oct 2012
    • 4

    call 3rd party extensions func from PHP extension

    Hi, im wondering is there a way to call 3rd party extension function from my own PHP extension? like make an MySQL query.

    for now i only can imagine a "proxy" method with zend_eval_strin g() which isnt that good i guess, i also know that i can access standard php function mostly by prefixing them with "php_" like "php_printf ", is there way to call mysql function same way? (and if so, how can i know their internal names and signatures?)
    tnx ^)
  • jdstankosky
    New Member
    • Sep 2012
    • 30

    #2
    You have confused me, Sir. Could your please clarify, post some code, draw a diagram, something to help me understand?

    Anyone else understand what he's trying to do?

    Comment

    • Qwaygon
      New Member
      • Oct 2012
      • 4

      #3
      im new to PHP extension development, and while there are few good tutorials i cant find an example for may particular situation.
      this is sort of what i can do in PHP

      Code:
      $link = mysql_connect(...);
      mysql_select_db(...);
      $result = mysql_query(...);
      $line = mysql_fetch_array($result, MYSQL_ASSOC);
      is there way to call mysql_connect/mysql_select_db/... etc from within my extension? same way as i can call php_printf() as of now i can only think of using zend_eval_strin g() and pass PHP code to it. hope this makes it more clear ^)
      Last edited by Dormilich; Oct 4 '12, 08:11 AM. Reason: Please use [CODE] [/CODE] tags when posting code.

      Comment

      • jdstankosky
        New Member
        • Sep 2012
        • 30

        #4
        Those are built-in functions. You should have no problem using them as-is in your own application.

        Are you aware of http://www.php.net/docs.php ? You can read about all the internal functions like the mysql functions on their site.

        Just let us know if you need any additional help!

        Comment

        • Qwaygon
          New Member
          • Oct 2012
          • 4

          #5
          tnx for quick answer, i cant test it right away, but didn't those are userspace (PHP space) functions? please see this question http://bytes.com/topic/php/answers/8...-php-extension as related, differnece in my case that mysql_connect is not one of the core function but part of mysql.so extension.

          edited - guess im saved

          :) all headers here
          Last edited by Qwaygon; Oct 3 '12, 02:45 PM. Reason: found possible solution

          Comment

          • Qwaygon
            New Member
            • Oct 2012
            • 4

            #6
            in case anyone will find this thread this is the answer

            search here for PHP space function and then look into souces to see internal function name
            in my case
            Code:
            PHP_FUNCTION(mysql_connect)
            {
                php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
            }
            Last edited by Dormilich; Oct 4 '12, 08:12 AM. Reason: Please use [CODE] [/CODE] tags when posting code.

            Comment

            Working...