Okay, maybe I just need a Blue Monster and some sleep, but....
I'm scraping a ringtone site just so that I can download all of the ringtones and add them to my personal library.
The website's code that I am targeting is:
Code: [Select]<tr><td><a href="/ringtone/527783/"><img src="/img/icon/ringt.jpg" border=0>Jackson 5 - Who's Loving You </a> </td><td align=center><a href="/ringtones/classical/" class=cat_link>Classical</a></td><td align=center><img src="/img/rating/star0.gif" border=0></td><td align="right" class=smgrey2>5 months ago</td><td align="center" class=smgrey2><span class="b">13895</span></td><td align="right"><span class="b"><a href="/profile/stambaugh01">stambaugh01</a></span></td></tr>
I would like for it to output the actual filename which in this case would be 527783. I would also like for it to output the title of the file.
There are about 50 or so listings per page, and would like for it to automatically go to the next page to scrape.
Here is my code:
Code: [Select]<?
$data = @file_get_contents("http://www.XXXXXXXXXXXX.com/ringtones/classical/");
preg_match_all('/href="/ringtone/.*?<img src="/img/icon/ringt.jpg" border=0>([^"]*).*?/"><img src="/img/icon/.*?border=0>([^"]*)</td><td align=center>/is',$data,$out);
// preg_match_all('/href="/ringtone/.*?<img src="/img/icon/ringt.jpg" border=0>([^"]*).*?/"><img src="/img/icon/.*?border=0>([^"]*)</td><td align=center>/is',$data,$out);
if ((isset($out[1]) && isset($out[2])) === FALSE) { // Let's do some error checking to see if there is data to insert into the database. If not let's end the script
break;
}
$d = array_combine($out[1], $out[2]);
// End Error Checking
foreach($d as $k=>$v){
echo $k . " --- " . $v . "
";
}
?>
The output is skipping and only outputting the title of every other row, but now directory name.
Thanks in advance for the help.
ldap connection
We are using ldap to get user information from the domain controller. It was working before. Recently I found the application is hanging at ldap_connect. It doesn't return any message. i am not sure
Problem with passing variables
I'm not really a php programmer so I'm really struggling with this issue. I have a banner script that is supposed to send people to an affiliate site and pass the parameters along with it.For
Unique Visitor Tracking
Hello. Currently, I run a voting site where voters are tracked by their IP address and can only vote once every 12 hours.The system works well, except it can be exploited very easily. Visitor's only
removing space from the end of a variable
i have a variable $image which contains the following url "http://tiles.xbox.com/tiles/oo/P5/0mdsb2JgbA9ECgR8GgMfWSpVL2ljb24vMC84MDAwIAABAAAAAP3Wg70=.jpg"but for some reason it is breaking
getting Vars to pass to next page.
Hello all, I have a confusing situation on my hands, i am a member of a gaming community and we are setting up a website (yay i get to be teh techie!!) im not exactly a noob with php but i am by far
sendmail code suddenly not working
Hi Guys, I maintain 3 sites (including my own) I use the following code from a french webmaster that gave me permission to use it. He designed & coded one of them. Now the code seems to have
mySQL and PHP search
Hello,I am trying to code a project and ran into a brick wall with one of my pages. I am pretty new at php/mySQL and can not figure this out. Now I know that you are not going to sit there and type my
Logging and nologging bulk insert
Hi,
Need PHP help... have all the elements... just need help putting them together :
Hey Guys, I was wondering if someone could help me. I am doing a website for a client which is about warranties and insurance. There is an enquiry form which the customer will fill in, and when they
Losing 'page' data
I have this code that allows me to update my database. But after updating, I lose the $_GET['page'] value in the browser. I need this value because it is passed when I go to other pages on the