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 Link to comment https://forums.phpfreaks.com/topic/213286-search-external-website/ 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; Link to comment https://forums.phpfreaks.com/topic/213286-search-external-website/#findComment-1110548 Share on other sites More sharing options...
fortnox007 Posted September 13, 2010 Share Posted September 13, 2010 Nice, thx for the clear explanation Link to comment https://forums.phpfreaks.com/topic/213286-search-external-website/#findComment-1110560 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 Link to comment https://forums.phpfreaks.com/topic/213286-search-external-website/#findComment-1110584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.