seblondres Posted March 26, 2016 Share Posted March 26, 2016 (edited) Hi, I have this script below which select random keywords from a file: <?php $search = explode("\n", file_get_contents('keywords.txt')); $search[ array_rand($search) ]; ?> Now I want to randomly pass those keywords in an URL so I can $_Get them e.g. http://example.com/index.php?keyword={A random keyword from my text file} If someone could point me to the right direction. Many Thanks, Edited March 26, 2016 by seb_london Link to comment Share on other sites More sharing options...
seblondres Posted March 26, 2016 Author Share Posted March 26, 2016 Ok I found a solution to my post: $keywords = explode("\n", file_get_contents('keywords.txt')); $search = $keywords[ array_rand($keywords) ]; Instead I passing the random keywords as a query keyword='.$search.' in my API url: e.g. $productsResult = simplexml_load_file('http://site.com?publisherId=xxx&placementId=&categoryId=&keyword='.$search.'&apiKey=xxxx'); Thanks, Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now