I’m trying to emulate using ROOT something a colleague has written in MATLAB. There is an sql db behind a firewall that we need to access through a php interface (I found out after wasting a lot of time trying to connect). The MATLAB code is as simple as:
I’m struggling as I look through tutorials, scavenge Root Talk, and scour Google to find a method that can do the same in ROOT. I ended up finding the ReadRemote method define in ($ROOTSYS)/test/rhtml/rhtml.cxx that might get me there. I was surprised to see a web browser built in ROOT, but that tells me that it can be done!
I’m still trying to interface with a php frontend for a mysql database in ROOT. To start off with, I tried to get this php interface to play nice with wget and curl first because I’m more familiar with them. The following command works:
The results are:
[code] database1
database2[/code]
That’s good. If I leave out the --post-data then I get the result:
[code]Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'localhost' (using password: NO) in /log/log_query_matlab.php on line 6
i'm dead! Access denied for user 'admin'@'localhost' (using password: NO)
Warning: mysql_query() [function.mysql-query]: Access denied for user 'admin'@'localhost' (using password: NO) in /log/log_query_matlab.php on line 29
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /log/log_query_matlab.php on line 29[/code]
I have access to the php script (read only), but the error itself isn’t too important. What matters it that using ROOT, I use the function called as socket.SendRaw(message, message.Length()) (socket is a TSocket and this was found in rhtml) and this gives me the same “error” as wget without the post data switch if my “message” is
This may be in vain, but does someone knows a way I should format the “message” that includes something that is equivalent to the --post-data switch. Or, is there a standard way to format POST requests in a single line (I’ve seen multi-line stuff (jmarshall.com/easy/http/#postmethod). Is that right?) Sorry I’m clueless!
PS. The mysql query is show databases but the space has been replaced with spazio, Italian for space. The author of the db and php interface requires it (and various replacements for symbols), but has anyone seen this before? Trying to troubleshoot that was terrible!
The databases available are lug and test, so there’s a lot of parsing to be done, but it most definitely worked! I wasn’t specifying the Host twice, and I was missing some \r\n. Great thanks.
Is there, by chance, an easy way you would know of to parse out the header that is sent back and leave only the query results?