Jump to content

thales.pereira

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

thales.pereira's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry the double post, but anyone belive this is a better solution? instead storing the file, i could store the information of the file into a field, and when i need it i could extract the data to a local file. <?xml version="1.0" encoding="UTF-8"?> <Values version="2.0"> <value name="node_type">ConnectionData</value> <value name="node_nsName">Adapters:Qry</value> <value name="node_pkg">Adapters</value> <value name="IRTNODE_VERSION">1</value> <value name="IRTNODE_PROPERTY">CwQAAAABBQEEGQBjAG8AbQAuAHcAbQAuAGQAYQB0AGEALgBJAFMATQBlAG0ARABhAHQAYQBJAG0AcABsBBUAYwBvAG4AbgBlAGMAdABpAG8AbgBOAG8AZABlAFYAZQByAHMAaQBvAG4LBAAAAAEEDwBhAGQAYQBwAHQAZQByAFQAeQBwAGUATgBhAG0AZQQLAEoARABCAEMAQQBkAGEAcAB0AGUAcgQZAGMAbwBuAG4AZQBjAHQAaQBvAG4ARgBhAGMAdABvAHIAeQBUAHkAcABlAE4AYQBtAGUENgBjAG8AbQAuAHcAbQAuAGEAZABhAHAAdABlAHIALgB3AG0AagBkAGIAYwAuAGMAbwBuAG4AZQBjAHQAaQBvAG4ALgBKAEQAQgBDAEMAbwBuAG4AZQBjAHQAaQBvAG4ARgBhAGMAdABvAHIAeQQUAGMAbwBuAG4AZQBjAHQAaQBvAG4AUAByAG8AcABlAHIAdABpAGUAcwUBAAIEDwB0AHIAYQBuAHMAYQBjAHQAaQBvAG4AVAB5AHAAZQQOAE4ATwBfAFQAUgBBAE4AUwBBAEMAVABJAE8ATgQPAGQAYQB0AGEAcwBvAHUAcgBjAGUAQwB</value> </Values> Sugestions?
  2. Yes, i started this a few minutes ago, just have this part of code and i have created a table with one field only. Once i get it working i will do the rest. Thanks for you reply
  3. Hi, im trying to store and retrieve some small files ( 3k min 15k max ) into a table, but until now only figure out how to store I dont know if this is the best way, but i think it works ( i dont know if it stores the file right into the table, but i can see the table growing ) <?php #bd config include 'config.php'; #bd call include 'opendb.php'; $name='node.ndf'; $fp = fopen($name, 'rb'); $content = fread($fp, filesize($name)); $content = pg_escape_string($content); $sql=("insert into storage values ('$content'::bytea)"); pg_query($sql) or die(pg_last_error()); ?> But how do i extract those files from the table? PS: the postgresqlField to store is bytea. Regards, Thales Pereira
  4. set my computer on fire? lol, i want to see that testing it right now edit: awesome, it worked very well, but the code is only getting the first entrance of the user, how can i apply this solution for a repetition of 50 or more users? <TD valign=top><B>name</B></TD> <TD>santosani</TD> </TR> <TR> <TD valign=top><B>password</B></TD> <TD>**********************************</TD> </TR> <TR> <TD valign=top><B>membership</B></TD> <TD> <TABLE> <TR> <TD>Administrators</TD> </TR> <TR> <TD>Developers</TD> </TR> <TR> <TD>Everybody</TD> </TR> </TABLE> </TD> </TR> </TABLE> </TD> </TR> <TR> <TD><TABLE bgcolor=#dddddd border=1> thanks!
  5. Hello all, I have the following extract of html output which repeats for every user: <TD valign=top><B>name</B></TD> <TD>santosani</TD> </TR> <TR> <TD valign=top><B>password</B></TD> <TD>**********************************</TD> </TR> <TR> <TD valign=top><B>membership</B></TD> <TD> <TABLE> <TR> <TD>Administrators</TD> </TR> <TR> <TD>Developers</TD> </TR> <TR> <TD>Everybody</TD> </TR> </TABLE> </TD> </TR> </TABLE> </TD> </TR> <TR> <TD><TABLE bgcolor=#dddddd border=1> What im trying to do, is extract the username and all the membership of that user. but to extract the memberhips i have to limit the search by getting everything between <TD valign=top><B>membership</B></TD> and <TD><TABLE bgcolor=#dddddd border=1> . The regex i have so far is: preg_match_all('#<TD valign=top><B>name</B></TD>\s<TD>(.*?)</TD>#i', $output, $match_user); Until now i only have the user and no clue about how i can get those fields. Thanks in advance.
  6. Hi, I have an 2 arrays ( $match[1] and $match[2] ) with 50+ fields that i need to insert into a database, but im not getting how i could do it. Until now im trying with with the following code: $sql="INSERT INTO is_trigger_reference (triggerName) VALUES ('$match[2][0]')"; mysql_query($sql) or die(mysql_error()); But when i check into the db table i only got: triggername ( field name ) Array[0] ( data inserted) I know i can set a var to each array ( 40+ ) but i belive there's something more clean than that Thanks!
  7. Helllo all, Again, im struggling at one situation. The following output is a extract from a group html file where name = group name and Membership are the members that have access to the group. So, im trying to extract that information and insert into a database ( i got no problem with that ) but i just cant figure it out how im able to extract just the group name, and all the members for that group. On this example, i just pasted with two groups, but the original file have 20+ <TD valign="top"><B>name</B></TD> <TD>Administrators</TD> </TR> <TR> <TD valign="top"><B>membership</B></TD> <TD> <TABLE> <TR> <TD>Administrator</TD> </TR> <TR> <TD>MWM</TD> </TR> <TR> <TD>MW_USER</TD> </TR> <TD valign="top"><B>name</B></TD> <TD>Developers</TD> </TR> <TR> <TD valign="top"><B>membership</B></TD> <TD> <TABLE> <TR> <TD>user_a</TD> </TR> <TR> <TD>user_b</TD> </TR> <TR> <TD>user_c</TD> </TR> and more... Until now, im only able to get the group names: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://$iUser:$iPass@$iHost/invoke/wm.server.access/groupList"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); preg_match_all('#name</B></TD>\s<td>([^<]+)#i', $output, $match); print_r($match[1]); } Current Output: Array ( [0] => Administrators [1] => Developers ) But what i really need is something like: Array ( [0] => Administrators Array ( [0] => Administrator [1] => MWM [2] => MW_USER ) [1] => Developers Array ( [0] => user_a [1] => user_b [2] => user_c ) ) If anyone have idea about how im able to do this, would be awesome thanks in advance!
  8. Hi, got it working with: preg_match_all('/<TD valign="top"><B>nameList<\/B><\/TD>.*?<TD>([^<]+)<\/TD>/is', $test, $out);
  9. Hello again I was trying to solve this by myself and again im struggling on this apparently simple regex. For now i have the code bellow, with the following code: $html_c2 = file_get_contents("http://somehost"); print_r($html_c2); With the following output: --------OUTPUT--------- <BODY bgcolor=#dddddd> <TABLE bgcolor=#dddddd border=1> <TR> <TD valign=top><B>acl</B></TD> <TD>ACL</TD> </TR> <TR> <TD valign=top><B>aclList</B></TD> <TD> <TABLE> <TR> <TD>ACL</TD> </TR> </TABLE> </TD> </TR> <TR> <TD valign=top><B>nameList</B></TD> <TD> <TABLE> </TABLE> </TD> </TR> </TABLE> </BODY> <BODY bgcolor=#dddddd> <TABLE bgcolor=#dddddd border=1> <TR> <TD valign=top><B>acl</B></TD> <TD>Administrators</TD> </TR> <TR> <TD valign=top><B>aclList</B></TD> <TD> <TABLE> <TR> <TD>Administrators</TD> </TR> </TABLE> </TD> </TR> <TR> <TD valign=top><B>nameList</B></TD> <TD> <TABLE> <TR> <TD>wm.server</TD> </TR> <TR> <TD>wm.server.dispatcher.adminui</TD> </TR> <TR> <TD>wm.server.ports:listListeners</TD> </TR> <TR> What im searching for, is print everyline after the field nameList. until now, i had two ideas: 1) using the code bellow to retrieve all lines that have <TD> , but need to print all lines after the line 4 of the array $html_c2 = file_get_contents("http://somehost"); preg_match_all('/<TD>.*/', $html_c2, $acl_c2); print_r($acl_c2); ---current ouput---- Array ( [0] => Array ( [0] => <TD>Administrators</TD> [1] => <TD> [2] => <TD>Administrators</TD> [3] => <TD> [4] => <TD>wm.server</TD> [5] => <TD>wm.server.dispatcher.adminui</TD> [6] => <TD>wm.server.ports:listListeners</TD> [7] => <TD>wm.server.replicator</TD> [8] => <TD>wm.server.replicator.adminui</TD> [9] => <TD>wm.server.net.listeners</TD> many more lines.... Desired output Array ( [0] => Array ( [1] => wm.server [2] => wm.server.dispatcher.adminui [3] => wm.server.ports:listListeners [4] => wm.server.replicator [5] => wm.server.replicator.adminui [6] => wm.server.net.listeners many more lines.... 2) Using strip tags, to remove html tags, but im unable to discover how i can get rid of the whitespaces, and get the output after the Field nameList $html_c2 = strip_tags(file_get_contents("http://somehost")); print_r($html_c2); --Current output-- acl ACL aclList ACL nameList acl Administrators aclList Administrators nameList wm.server wm.server.dispatcher.adminui wm.server.ports:listListeners wm.server.replicator wm.server.replicator.adminui wm.server.net.listeners Desired output: wm.server wm.server.dispatcher.adminui wm.server.ports:listListeners wm.server.replicator wm.server.replicator.adminui wm.server.net.listeners I dont know wich idea could be faster or easier, but is what i had in mind until now... If anyone have a solution for this, would be great. thanks all for at least looking into it
  10. I tested yours first. Since it worked, i didn't tried the first suggestion by sasa.
  11. Thank you both for the reply. it worked like a charm
  12. Hello everyone, Im new on regex and im blocking my brain with this one... i have a php file wich extract an html page seeking for every entry which is located bellow the tag <TD valign="top"><B>name</B></TD> for example: <TD valign="top"><B>name</B></TD> <TD>Administrators</TD> </TR> <TR> <TD valign="top"><B>inUse</B></TD> <TD>true</TD> </TR> <TR> <TD valign="top"><B>allow</B></TD> <TD valign="top"><B>name</B></TD> <TD>Users</TD> </TR> <TR> <TD valign="top"><B>inUse</B></TD> <TD>true</TD> </TR> <TR> <TD valign="top"><B>allow</B></TD> <TD valign="top"><B>name</B></TD> <TD>Developers</TD> </TR> <TR> <TD valign="top"><B>inUse</B></TD> <TD>true</TD> </TR> <TR> <TD valign="top"><B>allow</B></TD> Until now, im only able seek the lines with: $html = strip_tags(file_get_contents("http://$iUser:$iPass@$iHost/invoke/wm.server.access/aclList")); preg_match_all('/(name.*\n.*)/', substr($html,3), $matches); print_r ($matches) ##### OUTPUT ###### Array ( [ 0 ] => Array ( [ 0 ] => name Administrators [ 1 ] => name Users [ 2 ] => name Developers ) ) but... my desirable output is: ##### OUTPUT ###### Array ( [ 0 ] => Array ( [ 0 ] => Administrators [ 1 ] => Users [ 2 ] => Developers ) ) If anyone could help on this, im paying a virtual beer
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.