hi how to send sql query to remote server.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mak1084
    New Member
    • Jul 2007
    • 44

    hi how to send sql query to remote server.

    Hi,
    I want to make online registration script. To do this I searched google and found that cURL can be used, to send a query to the remote sever and getting the data back.
    Can you guys help me I'm not able to get any thing how to use cURL to send the query to remote server and getting back the result of the query.


    thank in Advance.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Mak.

    Do you need to send a query to a SQL server or to a PHP server? What database server software are you running?

    Comment

    • mak1084
      New Member
      • Jul 2007
      • 44

      #3
      Originally posted by pbmods
      Heya, Mak.

      Do you need to send a query to a SQL server or to a PHP server? What database server software are you running?

      I want to send to a php server. and im runnig a mysql. at both side i mean on both server.
      how do i use curl is main concern here. Can i use url rewriting here but how?

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Alrightey. Here's a quick tutorial that should get you started: http://blog.unitedheroes.net/curl/.

        Comment

        • mak1084
          New Member
          • Jul 2007
          • 44

          #5
          Originally posted by pbmods
          Alrightey. Here's a quick tutorial that should get you started: http://blog.unitedheroes.net/curl/.

          hey thanks for the link it really helped me. and now I can little understand the cURL but I still not understanding how to pass the sql query to the example.com get the result.

          say my query will be

          Select * from register where id = '$varible'

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            Originally posted by mak1084
            hey thanks for the link it really helped me. and now I can little understand the cURL but I still not understanding how to pass the sql query to the example.com get the result.

            say my query will be

            Select * from register where id = '$varible'
            Does it have to go through a second PHP server, or can you directly connect to the SQL server (via mysql_connect() or the like) from your script?

            Comment

            • mak1084
              New Member
              • Jul 2007
              • 44

              #7
              Originally posted by pbmods
              Does it have to go through a second PHP server, or can you directly connect to the SQL server (via mysql_connect() or the like) from your script?
              Hey If the request goes from the php server then i have to write script on both server. and If I use mysql_connect() then all code will be in first server it self.

              but dont you think giving a user name and pass to the from remote server will be safe?

              Comment

              • pbmods
                Recognized Expert Expert
                • Apr 2007
                • 5821

                #8
                Originally posted by mak1084
                Hey If the request goes from the php server then i have to write script on both server. and If I use mysql_connect() then all code will be in first server it self.
                It seems to me like you'd have to duplicate the code on both servers anyway if you want to send inline queries. You might as well just duplicate the connection code.

                Originally posted by mak1084
                but dont you think giving a user name and pass to the from remote server will be safe?
                If your MySQL installation supports it, you can set the MYSQL_CLIENT_SS L flag to connect via SSL to keep your login credentials secure (http://php.net/mysql_connect).

                Comment

                Working...