-
Posts
266 -
Joined
-
Last visited
Everything posted by devWhiz
-
shit man so simple! how did I not think of that.. prob cuz I tried it without implode and it just wrote "Array" to the file Lol, thanks man I appreciate it!! And last.fm is a site where people can discover new music based on the music you scrobble on yor computer with the last fm scrobbler, so it records everything you listen to and recommend similar artists to broaden your taste and such in music.. if that makes sense well this script loads members pages from group on the site that people put together so people can talk about music and such, well the script loads all of the ids of members in the group.. and writes to a text file.. Later on I am going to make a script that will request friendship with that list of ids.. I will have a couple hundred thousand by time Im done Thanks for the help, Im sure I will need some help when I go to write the script to add the friends, I usually get stuck where it is always a simple solution.. Lol
-
Cant edit above post, but this is the code I have.. <?php $file = 'Lastfm IDs.txt'; $ch = curl_init(); for($cwb=1; $cwb!=399; $cwb++) { curl_setopt($ch, CURLOPT_URL, "http://www.last.fm/group/i'm+not+anti-social%2C+i+just+enjoy+my+music./members?memberspage=".$cwb); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); preg_match_all('/id="r4_([\d]+)">/', curl_exec($ch), $matches); file_put_contents($file, implode($matches[1], "\n"), FILE_APPEND); echo "#".$cwb." pages with user ids loaded...\n"; } curl_close($ch); sleep(100000); ?> now,, everytime it does a loop it loads a different members page.., every time it loads a new one and writes the ids from that page.. it looks like this in the id file 14423441 32839962 36683385 3670648838089858 11899884 31379239 31517343 14856674 when it should be 14423441 32839962 36683385 36706488 38089858 11899884 31379239 31517343 14856674 Thanks for the help man
-
sweet that works! now one last thing and ill be done.. how would I add a \n line break at the beginning of each id
-
Wildteen your awesome!! helped me with alot of stuff today.. one more question so file_put_contents($file, implode("\n", "blah".$matches[1])); writes the matches each on a new line... how would I go about putting something in front of the id like this $ID[] = 1234578; $ID[] = 1234578; $ID[] = 1234578; $ID[] = 1234578; $ID[] = 1234578; $ID[] = 1234578; instead of 1234578 1234578 1234578 1234578 1234578 Thanks!
-
<?php $file = 'test.txt'; $lastfm = file_get_contents('http://www.last.fm/group/Rishloo/members'); preg_match_all('/id="r4_([\d]+)">/', $lastfm, $matches); file_put_contents($file, $matches[1]); sleep(100000); ?> That puts the array in a file but I need each value on a new line but it bunches it all up.. this just puts "Array" in file <?php $file = 'test.txt'; $lastfm = file_get_contents('http://www.last.fm/group/Rishloo/members'); preg_match_all('/id="r4_([\d]+)">/', $lastfm, $matches); file_put_contents($file, $matches[1]."\n"); sleep(100000); ?> what do I need to do to print all of the values on a new line? Thanks
-
yep r4 is the same all the time, Thanks man! I aqppreciate the help, it worked I need to learn preg match.. It would help out alot for the stuff I do, any tips?
-
if I have this info in a doc " id="r4_20770702"> how would I use preg_match or preg_match_all to parse ot the number 20770702 and would it be different to parse ot more than one id in that form like... " id="r4_20770702"> " id="r4_35133964"> " id="r4_38461866"> " id="r4_31859736">
-
do you have any code examples I can look at?
-
it just echos the contents of http://www.last.fm/group/Rishloo/members it looks like...
-
$lastfm = file_get_contents('http://www.last.fm/group/Rishloo/members'); $users = explode('" id="r4_', $lastfm); $users = explode('">', $users[1]); var_dump($users[0]); that is only echoing one ID http://www.last.fm/group/Rishloo/members 1 id for each member it should be echoing.. any idea why it isnt? $lastfm = file_get_contents('http://www.last.fm/group/Rishloo/members'); $grab_id=explode('" id="r4_', $lastfm); for($b=1; $b<count($grab_id); $b++){ $getid=explode('">', $grab_id[$b]); echo count($getid[0]); } that echos all 1's.. any help is appreciated.. thanks thanks
-
<?php function URLs(){ $a = "http://www.yahoo.com"; $b = "http://www.google.com"; $c = "http://www.phpfreaks.com"; return($b); } echo URLs($b); sleep(10000); ?> how would I get it to echo out $a without having to change the return value in the function, I want it to be like where I can put URLs($c) without having to change the return part of the function, any help is appreciated, thanks
-
$thread_url = explode('<meta property="og:url" content="', curl_exec($ch)); $thread_url = explode('?s=', $thread_url[1]); $title = explode("http://forums.blahblah.com/threads/$z-", curl_exec($ch)); $title = explode("?s=", $title[1]); Code was messed up in the first post
-
$thread_url = explode('<meta property="og:url" content="', curl_exec($ch)); $thread_url = explode('?s=', $thread_url[1]); $title = explode("http://forums.blahblah.com/threads/$z-", curl_exec($ch)); $title = explode("?s=", $title[1]);[code=php:0] so instead of it executing the curl each time to get the variable $thread_url and $title.. is there a way I can only execute the url only once and check for $thread_url and $title with only executing once.. Any help is appreciated. thanks
-
so I use file_get_contents to get the contents of a webpage, one of the lines has <meta property="og:url" content="http://www.google.com/blahblahblah?s=5cd04d4a7632296b9cdb463d04e82c05" /> I want it to echo only http://www.google.com/blahblahblah so anything between <meta property="og:url" content=" and ?s=5cd04d4a7632296b9cdb463d04e82c05" /> I want to extract and put into a variable this works just fine but I was thinking preg match would be better $thread = explode('<meta property="og:url" content="', $psuc); $thread = explode('?s=', $thread[1]); echo $thread[0]; Thanks
-
so if I have a a string of text or something like http://www.yahoo.com/ajhsijd908340 I can use str_replace to remove "http://" but what can I use to remove the "ajhsijd908340" if every time it is a different set of characters?
-
So, I've been compiling all of my scripts to .exe so no one can see my code and release it to other people without my permission so on my site I have place a script that, if I put a users IP in the script it will display their ip when they load the script this is the code for the script hosted on my site <?php $ADDRESS = $_SERVER['REMOTE_ADDR']; if(stristr($ADDRESS, '00.000.000.000') || stristr($ADDRESS, '123.456.16.548')) { echo $ADDRESS; }else{ echo "NOT AUTHORIZED TO VIEW THIS PAGE"; } ?> so if the persons IP address is not 00.000.000.000 or 123.456.16.548 it will not display their IP so on the script I made this code <?php $ip = file_get_contents('script URL'); if(stristr($ip, '123.456.16.548')) { echo "Script can begin...."; // CODE HERE // }else { echo "you are not authorized to use this script"; } ?> when the script is in .exe form they cannot edit the link or the IP that is in the script.. and if someone sends it out I can take their IP off of the if statement in the script on my site and it wont display their ip for the script the verify Is this good or is there a better way to do this? mysql doesnt work well when the script is encoded, otherwise I would have use mysql
-
ahh my stupidity, I had it using html extension LOL Thanks guys
-
oops didnt see that Lol Ok I put ; at the end of the variables as they should be and it is still not displaying the data in the table
-
<?php function money($amount,$separator=true,$simple=false){ return (true===$separator? (false===$simple? number_format($amount,2,'.',','): str_replace('.00','',money($amount)) ): (false===$simple? number_format($amount,2,'.',''): str_replace('.00','',money($amount,false)) ) ); } $income = 5000000000; $daily = money($income*24,true,true); $weekly = money(($income*24)*7,true,true); $monthly = money((($income*24)*7)*30,true,true); ?> </center> <center> <table border="1"> <tr> <td>Daily</td> <td><?php echo $daily ?></td> </tr> <tr> <td>Weekly</td> <td><?php echo $weekly ?></td> </tr> <tr> <td>Monthly</td> <td><?php echo $monthly ?></td> </tr> </table> </form> </center> What am I doing wrong? Im fairly new to this
-
I was told this was because of the new hashing algorithm in mysql after version 4.1 so I entered this query SET PASSWORD FOR bommobco_cwbtest@siteip = OLD_PASSWORD('mypassword'); and I get this error #1044 - Access denied for user 'bommobco'@'localhost' to database 'mysql' why does it say "user 'bommobco'@'localhost'" when I put bommobco_cwbtest@siteip and database mysql when I clicked on the other database... How can I get this to work? Thanks
-
Yes!! Thank you!