tommyda Posted January 10, 2008 Share Posted January 10, 2008 I need some help building a function that searches a specified page on an external site for a line of code (link), then returns true or false depending on whether it is there or not. I know it is possible because directorys use this function. I am willing to pay $10 though paypal or moneybookers to the first one who can help me Thanks for reading Tommy Arnold Quote Link to comment https://forums.phpfreaks.com/topic/85343-solved-10-paypal-for-quick-help/ Share on other sites More sharing options...
jaymc Posted January 10, 2008 Share Posted January 10, 2008 content = file_get_contents("www.google.com") That will get you the source code Now, how do you want to search for this line? Can you view the source of the site and paste the line you want, then we will know how to search for it Quote Link to comment https://forums.phpfreaks.com/topic/85343-solved-10-paypal-for-quick-help/#findComment-435456 Share on other sites More sharing options...
tommyda Posted January 10, 2008 Author Share Posted January 10, 2008 Ok just a link <a href="www.mysite.com">just a link</a> Quote Link to comment https://forums.phpfreaks.com/topic/85343-solved-10-paypal-for-quick-help/#findComment-435458 Share on other sites More sharing options...
jaymc Posted January 10, 2008 Share Posted January 10, 2008 View the source, does that link sit on its own on 1 line See, you will need to use regex to dig out that link, in which case you will need to give regex some rules to search by But if the website changes there code often, then it can screw things up For example today that link might be on line 923, where as tommorow it may be on line 966 Quote Link to comment https://forums.phpfreaks.com/topic/85343-solved-10-paypal-for-quick-help/#findComment-435465 Share on other sites More sharing options...
tommyda Posted January 10, 2008 Author Share Posted January 10, 2008 So how do the directorys do it? Directorys tell you to copy and paste a line of code then they search to see if its there and if it is they add your listing automatically This is exactly the function i need. Quote Link to comment https://forums.phpfreaks.com/topic/85343-solved-10-paypal-for-quick-help/#findComment-435469 Share on other sites More sharing options...
jaymc Posted January 10, 2008 Share Posted January 10, 2008 Yeh.. but its getting that function Unless it is piblically available, you will need or have someone write it Which is why its important to know how there source is wrote A function will need to know how and what to read in order to select the criteria you are looking for Regex, line numbers, what ever... Unles there is some super pre made function that can do it... Quote Link to comment https://forums.phpfreaks.com/topic/85343-solved-10-paypal-for-quick-help/#findComment-435472 Share on other sites More sharing options...
tommyda Posted January 10, 2008 Author Share Posted January 10, 2008 Ok well i have someone working on it now from the digital point forum But thanks for trying! Quote Link to comment https://forums.phpfreaks.com/topic/85343-solved-10-paypal-for-quick-help/#findComment-435476 Share on other sites More sharing options...
helraizer Posted January 10, 2008 Share Posted January 10, 2008 Ok well i have someone working on it now from the digital point forum But thanks for trying! Surely the following will work, won't it? <?php $content = file_get_contents("http://www.google.co.uk"); // Loads the source code into a string if (stristr($content, '<a href="www.mysite.com">just a link</a>')) /* If that link is in the string it returns true, if not, it returns false. */ { return true; } else { return false; } ?> Sam Quote Link to comment https://forums.phpfreaks.com/topic/85343-solved-10-paypal-for-quick-help/#findComment-435482 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.