0

I am making a script. And in this script i will supply some keyword list. And then it will go to a targeted site and grabbing data. Please take a look to my code :

//my option start
$toplist=file_get_contents('http://mysite/list.txt');

//list grabbing

$listgrabbing=explode('target="_',$toplist);
$counting=count($listgrabbing);
$l='0';
for ($l=0 ; $l <=$counting ; $l++){
$targetsite='http://targetsite/search?q='.$listgrabbing;
$revip=file_get_contents($targetsite);

//Rest of code

now see, i have some keyword lists, in a txt file. . Such as :

football
cricket
basketball
chase 

and my code will take first keyword and search into target site and grab. And then second,third,forth... But it is not select keyword from list. What is the error here ?

9
  • Don't you need to be using explode("\r\n",$toplist) Commented Oct 29, 2012 at 17:45
  • @Bonzo ,Will you please clarify it. Commented Oct 29, 2012 at 17:47
  • 1
    $l='0' then using that $l in a for loop smacks of cargo-cult programming. Commented Oct 29, 2012 at 17:48
  • 1
    What does the text file look like? Commented Oct 29, 2012 at 17:51
  • @Bonzo , similar this one : digitalfinance.info/list.txt Commented Oct 29, 2012 at 17:53

1 Answer 1

1
$toplist=file_get_contents('http://mysite/list.txt');
$listgrabbing=explode("\n",$toplist);
foreach($listgrabbing as $item){
     $targetsite='http://targetsite/search?q='.$item;
     $revip=file_get_contents($targetsite);
}
Sign up to request clarification or add additional context in comments.

5 Comments

Is there any problem on my list ? I think so, because, i have used this. But it is not taking the keywords.
Yes, i am sure it is problem in keywords. because i have checked with a single keyword, and it's working.
then how should i write the list ?
Just like the http://digitalfinance.info/list.txt, I've uploaded an example using that file here https://bonzodanddcouk.fatcow.com/mine/trial.php
Thanks, It is now completed. Actually it is problem in "/n" . Now fixed with your code. Thanks Again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.