JordanStreet
-
Posts
16 -
Joined
-
Last visited
Never
Posts posted by JordanStreet
-
-
awsome, I understand what you did There is still 1 question I have
{<div style="display:none;">(.*)</div>}sU
it stops at the first </div>
but when I do
{<div style="display:none;">(.*)?</div>}s
it keeps going
can you help me with that ?
thanks,
Jordan
-
I am creating a PHP script that will take a downloaded web page (in html format) and pull certain information out of the page.
Here is what I have:
<? $location = 'requests/1.htm'; $page = file_get_contents($location); // get the title preg_match('{<title>Buy (.*) At Sam Ash</title>}',$page,$title); $title = $title[1]; echo "$title <p/>"; // get the product id preg_match('{var pr_page_id = \'(.*)?\';}',$page,$id); $id = $id[1]; echo "$id <p/>"; // get the price preg_match('{color: #990000;">\$(.*)?</font>}',$page,$price); $price = $price[1]; $price = $price * 1.17; $price = round($price,2); echo "$price <p/>"; // get the description preg_match('{<div style="display:none;">(.*)</div>}',$page,$description); print_r($description); ?>
Everything works fine except for this part
// get the description preg_match('{<div style="display:none;">(.*)</div>}',$page,$description); print_r($description);
the part of the html that this applies to looks like this
<div style="display:none;"><P>Derived from a mahogany body/neck and headstock in conjunction with a solid spruce top, the EA15TR produces a full range of sound with a wide range of dynamics. The large body teamed up with the solid top, allows the pristine and crystal high notes to blend perfectly with the full, well rounded bass. 21 frets sit on top of a rosewood fingerboard bound in white. The top and back of the body are bound with multi-ply bright white binding that when coupled with the abalone rosette around the sound hole, ties this guitar together visually. On stage dial in the exact sound you desire with the B-Band preamp. While on that stage the EA15TR is sure to stay in tune with the Chrome Grover tuners. This guitar is an all around work horse that will reward you with countless hours of playing enjoyment. Case not included.</P> <P><STRONG>Specifications:</STRONG></P> <UL> <LI>Mahogany body <LI>Solid spruce top <LI>Mahogany neck <LI>Rosewood fingerboard <LI>B-Band electronics <LI>Chrome Grover tuners <LI>Abalone sound hole inlay <LI>Diamond inlays</LI></UL> <P><B>Washburn Limited Lifetime Warranty<BR></B>Washburn instruments are warranted to be free from defective material and workmanship from the date of purchase to the original purchaser when purchased from an authorized Washburn dealer. The Washburn Limited Lifetime Warranty covers repair parts and labor.</P> <P></P> <P>Washburn will repair or replace, at its option, any Washburn instrument or part thereof which is found by Washburn to be defective. </P></div>
you can view it in action here http://guitarvideos.org/store/samashbot/
Thanks guys, I appreciate your time reading this (and hopefully responding )
-
I have a page with a lot of html jiberish and burried in that page is a series of links in the form of
<a href="site.php?site=xxxxx">xxxxx</a>
I want php to do this.
Search through the file and find each <a href="site.php?site=xxxxx">xxxxx</a> then isolate what is between site= and "> then add that to an array so that
$matches[0] = xxxxx
$matches[1] = xxxxx
How would I go about doing this ?
Thanks in advance guys
-
alright here is a better question, I have a script that makes a dir by doing
mkdir($dirname);
the problem is when i upload it to my server it says permission denied so how do I give permission to register.php to make dirs ? -
okay lol i figured that out but how would i fix it
-
http://www.precision-pixels.com/sigsystem
I for some reason can't delete files in my ftp, it says permission denied. Anyway to fix this ? Sorry for my nubishness :P -
justwondering, cant php automatically chmod files and directories ? I would try dling some free cms' and such and looking at the installation file. Also pixel2life.com helps a lot.
-
yeah i echoed them again and noticed that there is a white space after the non trimed one. Yeah this deff brings some insight. Thanks again ;D
-
:) worked like a charm. Thanks a bunch man. However im looking in the php manual about the trim function and im a lil confused because as far as I know there was no what space in my text file. Could you maybe explain this a little more ?
-
okay here is the full code
<form action="login.php" method="post">
Username:<br/><input type="text" name="username"><br/>
Password:<br/><input type="password" name="password"><br/>
<input type="submit" name="submit" value="Login">
</form>
<?
if(isset($_POST['submit'])){
$username = $_POST['username'];
$password = $_POST['password'];
if(file_exists("members/$username")){
$info = file("members/$username");
if($password == $info[1]){
echo "login succes";
}else{
echo "wrong password";
}
}else{
echo "Username not found please try again.";
}
}
?>
and when i submit the form i use Jordan as the username and in the file members/jordan (no file extension) I have my password stored on the second line
the thing is i can echo $info[1] I just cant use it in the if statement
hope this clears things up -
here is my script
$password = 'mypass';
info = file("members/$username");
if($password == $info[1]){
echo "login succes";
}else{
echo "wrong password";
}
however no matter what it always returns false -
alright thanks bro ill cya around
-
thanks man that help a lot ! Do you or someone know where I could find like a php cheat sheat that lists all of the functions with examples of the formula. I think im calling them right, I mean like stuff like
checking to see if two variables are the same is ($variable1 == $variable2) -
okay awsome :D so the eregi looks at the first letter ?
-
What I am trying to do is create a script where s would = $ and w would equal @ and u would equal & etc. etc. So I know how to do that with the str_replace command. Now my question is could I make it so that if the first letter of the message was a-l it would use one set of replacements and if it was m-z it would use another set of replacements ?
Thanks a bunch
Jordan
regular expression accross multiple lines
in Regex Help
Posted
alright Thanks man I appreciate it
To summarize for anyone having this provlem.
1) I needed to ad the "s" at the end of the regex to make it so the "." stands for any character INCLUDING new line
2) To add laziness to my regex I needed to use the "?" at the end of the sub patern although I'm not sure why it has to be inside the sub partern instead of right after it.