|
Hey guys,
For the last couple of hours i've been messing around with regex. I've never dared to lay my hands on this so please bare with me.
Basicly i'm trying to get some info from the following source
<random htmlcode here>
<td style="BORDER-RIGHT-STYLE:none;">
<a id="dgWachtlijstFGI_ctl03_hlVolnaam" title="Klant wijzigen" class="wl" href="javascript:
Pop(600,860,'klantwijzig','FrmKlant.aspx','?Wijzig=true&lcSchermTitel=&zoekPK=+++140+12++8',false,true); ">FIRST LINE A</a>
(SECOND LINE A)<br>
THIRD LINE A
</td>
<random htmlcode here>
<td style="BORDER-RIGHT-STYLE:none;">
<a id="dgWachtlijstFGI_ctl04_hlVolnaam" title="Klant wijzigen" class="wl" href="javascript:
Pop(600,860,'klantwijzig','FrmKlant.aspx','?Wijzig=true&lcSchermTitel=&zoekPK=+++140+12++8',false,true); ">FIRST LINE B</a>
(SECOND LINE B)<br>
THIRD LINE B
</td>
<random htmlcode here>
What i came up with this far is the following (thanks to rubular.com)
<?php
$bestand = 'output.txt';
$fd = fopen($bestand,"r");
$message = fread($fd, filesize($bestand));
$regexp = "FrmKlant.aspx.*\">(.*)<\/a>\s(.*)<br>\s(.*)\s\s(.*)";
if(preg_match_all("#$regexp#siU", $message, $matches))
{
print_r($matches);
}
?>
This actually seems to put the first and second line i need in a multidimensional array. So far so good, because i want a multidimensional array.
However, it doesn't seem to capture the 3rd line. And somehow it creates array[4]
[1] => Array ( [0] => FIRST LINE A [1] => FIRST LINE B )
[2] => Array ( [0] => (SECOND LINE A) [1] => (SECOND LINE B) )
[3] => Array ( [0] => [1] => ) [4] => Array ( [0] => [1] => )
What i'm looking for is this:
[0] => Array ( [0] => FIRST LINE A [1] => FIRST LINE B )
[1] => Array ( [0] => (SECOND LINE A) [1] => (SECOND LINE B) )
[2] => Array ( [0] => THIRD LINE A [1] => THIRD LINE B ) )
As you might have noticed, i'm lost! Any help would be greatly appreciated.
|
|
|
|
|
Hi,
I've received an odd request from a client and can not figure out a sufficient way to solve the case which can be summarized as:
There is a MailTo link on a PHP coded page and as you all know once clicked it triggers the installed mail application, if there is any. In case there is no mail application installed on the client's pc is there a way to forward the client to another page with a mail to us form?
P.S. I know it could have make more sense to use only the mail form but this is exactly what is being expected :/
Thanks..
|
|
|
|
|
It seems to me that the problem is not one that PHP running on a server can handle, since the server has no way of knowing what is or isn't installed on the client where the browser is located.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Walt's right - this is a client-side issue. Maybe someone who knows about javascript/ajax could say whether you could do something like this pseudocode
<script>
function on_click_mail_request_button() {
if (start_mail_agent(to, subject, ...) != success)
document.URL = url_of_mail_page;
else
;
}
</script>
The real issue is whether there is such a thing as what I've called "start_mail_agent".
Good luck!
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Sounds like an exercise in managing user expectations.
If the goal is to permit the user to use a familiar email application if they have one else a form as a backup, then I would offer the user a add-on program to accomplish said task, at an inflated cost to develop (or outsource) and lost time (6 months+) that maybe can run under flash or java.
Or tell them you can design a web form that will provide a common interface based on html best practices while staying on budget and on time!
Then sit back and see how much money and time they are willing to throw at it...
|
|
|
|
|
Hi ,
I need to encrypt the plan text using AES algorithm in java and decrypt the encrypted text using C.Any please give solution ASAP.
Thanks in Advance
|
|
|
|
|
|
What has this got to do with Linux? C and Java are platform independent, so that means it can run on pretty much any platform that has available compilers, so this means that this is not really a question appropriate for this forum (Unless of course you are planning on using a library for the encryption/decryption that only runs on Linux, etc). A better place would be in the Java and C forums.
Programming is 10% science, 20% ingenuity, and 70% getting the ingenuity to work with the science.
WYSIWYMGIYRRLAAGW: What You See Is What You Might Get If You’re Really Really Lucky And All Goes Well.
|
|
|
|
|
Hi,
thanks for checking out my message
I need a help to convert .pyc files to .py files
i am currently working in python in which i have to decompile the python code and make changes.
For that i need to convert .pyc files to .py files
Any solutions to this issue?
Thanks
-
MK
|
|
|
|
|
|
hi,
Thanks for the useful suggestion u gave
The url you mentioned is a great help to me now i can convert .pyc files to .py files with ease. But i have one issue
when i am trying to convert a particular .pyc file it is returning a corresponding .py file but with 0 bytes .
No data is there ..
The file i am trying to convert .pyc file is 134.3KB size ..
All remaining files i can convert but this file is the main class file for the project i am working
So Kindly advise me any suggestions if any to this issue .
|
|
|
|
|
What is the process or function of acquiring a Mac address of a machine
|
|
|
|
|
for a local machine you can use something like exec to run a system command and then you can capture and parse the results.
remote machines...I do not think it is possible. To my memory (questionable at best ) Internet communication does not use the mac address for broadcasting information, only in identifying hardware within a network. Again, I am no expert but I have seen this question before. Maybe asking a hardware driver developer for routers and NICs may provide better insight.
|
|
|
|
|
|
hello, I could not understand how to use apache. I couldnot understand that how to run my cgi-scripts and php applications. please any one tell me.
|
|
|
|
|
In windows: use xampp. it is bundled with every of these XwindowsApacheMysqlPhpPerl so it is termed as xampp. for linux you have Lamp. One touch installer. and then go to xampp/htdocs folder . this is your document root. give a try and by this time i hope you would have got the answer because this post is two months old. I came here to ask a question but there aren't many posts anyway i will give a try.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Hi All,
I am trying to insert the detail into one table with 2 fields. but I am failed to insert. Here I am getting the below error message.
Warning: odbc_execute() [function.odbc-execute]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecute in C:\Inetpub\wwwroot\PHPProgs\StoreData.php on line 9
Whoops
below is the code what i have written.
Please let me know what is the problem
Looking for your valuable reply.
|
|
|
|
|
Sounds like you may have a permissions issue. Can you insert/update any information to the database or just this table...check your security settings in the db for the user that your script is logging in as.
|
|
|
|
|
|
Hello !
I have very simple expression in if statement:
"d"==0
So in my code it looks like this:
if ("d"==0)
{
//do something
}
Of course, booth sides aren't always like that, they are variables, but I saw that I had bug somewhere and it turned out that error occurs always when on one side is string and on other zero ...
Can anyone explain to me why does this return true ?? I can't see why string would be equal to zero ...
Thanks
|
|
|
|
|
It returns false because you are comparing a string literal to a number. If your string was if("0"==0) it should work.
You may want to try to write the statement like this.
<?php
$test_array = array(1,"a",3,"b",5,"c",7,"d","e",0,"f","g","h","i","j","k");
$i = 0
foreach($test_array as $x)
{
if($x==0)
{
echo "found You at index ".$i."!<br>";
exit;
}
else
{
echo "still looking<br>";
}
}
$i++;
?>
This should help you...
|
|
|
|
|
I've tried that, and it returned:
still looking
found You at index 1!
So PHP thought that "a" was equal to 0 ... again, string is equal to zero, like in my first post ... what's going on ? is it maybe just error in my php installation ?? Right now, I'm very confused
BTW,
I've just tried that script on some other web server, result is the same ... is this kind of bug in PHP or what ?
Thanks
|
|
|
|
|
Sorry made a mistake in the code. This is what it should look like. See if you can spot the change. Understanding the difference between this code and the first one I posted will answer your question. You can then test it further by moving the 0 (zero) to a different location within the array.
<?php
$test_array = array(1,"a",3,"b",5,"c",7,"d","e",0,"f","g","h","i","j","k");
$i = 0;
foreach($test_array as $x)
{
if($x==0)
{
echo "found You at index ".$i."!<br>";
exit;
}
else
{
echo "still looking<br>";
}
$i++;
}
?>
|
|
|
|
|
Thank you for your help, but if you mean that error was this line:
$i++;
outside of foreach loop, I've already fixed it before trying the sample and it still don't work ...
http://x.xx77abs.com/example.php[^]
As you can see, it tells me that if found zero at index 1, and you can see source code that was executed (it is yours )
|
|
|
|
|
I made a change to the code and got it to give the expected results.
foreach($test_array as $x)
{
echo $x."<br>";
if($x==0 && is_numeric($x))
The echo of $x shows it is (without the is_numeric function) stopping on "a", not what I would expect. Running the code with the is_numeric gives the correct result of index 9. I also tested === with the same results as the is_numeric.
Without spending more time researching this I can only assume that php is parsing "a" as being equal to 0. I suspect this maybe due to something the parser is doing to allow the testing of a string and an integer.
OK, I just did a little research and found this in the PHP manual...
String conversion to numbers
When a string is evaluated in a numeric context, the resulting value and type are determined as follows.
If the string does not contain any of the characters '.', 'e', or 'E' and the numeric value fits into integer type limits (as defined by PHP_INT_MAX), the string will be evaluated as an integer . In all other cases it will be evaluated as a float .
The value is given by the initial portion of the string . If the string starts with valid numeric data, this will be the value used. Otherwise, the value will be 0 (zero). Valid numeric data is an optional sign, followed by one or more digits (optionally containing a decimal point), followed by an optional exponent. The exponent is an 'e' or 'E' followed by one or more digits.
For more information on this conversion, see the Unix manual page for strtod(3).
A quick google on strtod shows me this...
Return Value
On success, the function returns the converted floating point number as a double value.
If no valid conversion could be performed, a zero value (0.0) is returned.
If the correct value is out of the range of representable values, a positive or negative HUGE_VAL is returned, and the global variable errno is set to ERANGE.
If the correct value would cause underflow, zero is returned and errno is set to ERANGE.
This looks to be the issue...but this is just a guess.
|
|
|
|
|