liamloveslearning Posted September 13, 2010 Share Posted September 13, 2010 Hi all, Im just wondering how you go about building a search function to another website, So on my webpage i could have a search that searchs the itunes store or something? Has anybody previous experience with this or can point me in the right direction, I have googled this but all im being shown is an overwhelming amount of results for google instant! thanks in advance Quote Link to comment Share on other sites More sharing options...
mraza Posted September 13, 2010 Share Posted September 13, 2010 You can do that with using cURL or file_get_contents() first you need to do query on site and then fetch results and with some regex display that to your end user. for example if itunes search query is here itunes.com/search.php?query=search+something then you need to point in your curl session to that url so a simple query should look like this $string = " search something"; $url = "itunes.com/search.php?query=" . $string; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); // rather then echo you need to parse returned page and display results echo $result; Quote Link to comment Share on other sites More sharing options...
fortnox007 Posted September 13, 2010 Share Posted September 13, 2010 Nice, thx for the clear explanation Quote Link to comment Share on other sites More sharing options...
liamloveslearning Posted September 13, 2010 Author Share Posted September 13, 2010 Ahh, Brilliant thanks mraza Ill have a good look into the functions Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.