PDA

View Full Version : Cron Jobs


midgetgrimm
08-18-2011, 10:37 PM
Hello,

I have a website http://www.gotgr.com, and I run various scheduled tasks. So now I want to run a cron to ping search engines via a cronjob. I tried using a 'wget' parameter but that just screwed up all my scheduled tasks.

So my question is: Can I ping search engines via scheduled tasks? If I can, how would I go about doing that with a varname and the parameters? Or can I run a seperate cron via cpanel that wont affect my othe scheduled tasks? Again, if I can, how? I know this is asking a lot, but I am looking for some help/guidance/direction/links. Thank you very much.

james

kh99
08-18-2011, 10:55 PM
It's probably just me, but I don't quite understand. What do you mean by ping, do you just want to request a page for some reason or are you trying to get info back? And what do you mean when you say you have a varname and parameters?

As far as I know you should be able to do it either way. I don't know why it would mess up your scheduled tasks unless maybe there's something wrong with the code you're using.

midgetgrimm
08-19-2011, 12:46 AM
Im sure there was something wrong with the code I was using. I jsut realized that my vb generates a sitemap daily, but i am curious if it sends it to search engines. To ping is to just let google or yahoo know that your sitemap updated and is ready for indexing

kh99
08-19-2011, 01:27 AM
Well, you could use the php function file_get_contents() (http://us2.php.net/manual/en/function.file-get-contents.php) and pass the url, but that will only work if PHP is configured to allow it. Otherwise you can try using curl (http://us2.php.net/manual/en/ref.curl.php), but I don't think that's included in PHP by default.

In includes/class_rss_poster.php there's code that gets RSS feeds to post as threads. It has a function called fetch_file_via_socket() which uses socket calls if curl isn't available.

That makes me think of a kind of hack - if you just need to make the request to the search engines but don't need to do anything with the page that's returned, maybe you could add them as rss feeds, and it will request them but never post anything because the return will always be invalid.