![]() |
quick php code help...
I want to put alot of urls into the php file, and once php file gets executed it will redirect to those urls one by one... like if I have 100 urls, once php file loads it will go to first url, then once php file get executed again it will load second url, and so on, then once it reaches the end it will start from the begging ... can someone hook me up please :)
|
Quote:
|
still looking :)
|
bump bump
|
If you are looking to invest a few bucks, icq: 33375924
|
Here's help. Otherwise, I could make it for you but $$ talks.
|
Quick and dirty way to do it:
Code:
|
Quote:
|
array + array_rand - and it's all done...
read the manual... |
Quote:
Takes a list of URLS. Each time the script is loaded, it redirects to the next, and so forth. What did I miss? |
Quote:
|
Quote:
A real solution would be to use a db or even xml file, but quantum-x has a solution that will work quite well :thumbsup |
q-x's solution will truncate the url file if the HD runs out of space. :)
(I know it's a quick and dirty free solution, just pointing out one potential issue.) |
Quote:
just :2 cents: |
Quote:
Parse error: syntax error, unexpected T_VARIABLE in /www/users/for/multiurl.php on line 3 |
$urls = file('URLS.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
Quote:
Fatal error: Call to undefined function: file_put_contents() in /www/users/for/multiurl.php on line 5 |
Quote:
Code:
$urls = file('URLS.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
Quote:
|
Quote:
|
... pay woj ...
|
Replace the file_put_contents(...) line with this
$fp = fopen('URLS.txt', 'r+'); fwrite($fp, implode("\r\n",$urls)) fclose($fp); |
Quote:
Code:
<?php |
Hey Killswitch, is the chick in your avatar some random_unverifiable_one_off_chick or from a program?
|
Quote:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 128 bytes) in /www/users/for/multiurl.php on line 6 |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
And you can see that free help isn't always so quick... by now you probably could have paid to get a working solution that you didn't have to worry about...
|
Quote:
|
Why the fuck are you running PHP4 - In one month's time it will have been discontinued for THREE YEARS.
No wonder shit is breaking ;) |
Does each redirect NEED to be sequential? If you do it randomly and there's enough loads (ie enough of a sample) then each URL will receive the same average amount of traffic anyway.
|
Quote:
|
Quote:
If you're out of space PHP will probaby grind itself to death when attempting to even run :) |
Quote:
|
Quote:
<?php $urls = file("URLS.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); header("HTTP/1.0 302 redirect"); header("Location: " . $urls[(rand(0, count($urls) - 1))]); ?> |
Quote:
|
Damn, I should have left out a semicolon or two and extorted $3.82 from you.
|
Sweet fucking Christ.
|
Quote:
|
Quote:
So long as your URL list isn't megs in size it should be fine. If it gets too big then PHP will die with an out of memory error. |
Quote:
Quote:
|
Quote:
|
Quote:
Please send $1.28 to me when he pays you, for keeping my mouth shut. Thanks. |
Quote:
|
Quote:
|
Quote:
Code:
<!-- |
All times are GMT -7. The time now is 10:07 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc