Does anyone here know how to turn a Curl crontab into a php script? example: 25 * * * * curl --user username:password http://www.website.com/wp-content/update-feeds.php -d update=quiet Code (markup): Thanks!
There are 2 options : - run the curl command with the shell_exec() command but this isn't allowed on most hosts - run the curl command from within the php page : $ch = curl_init('http://www.website.com/feed.php'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERPWD, $remote_login.':'.$remote_password); $contents = curl_exec($ch); curl_close($ch); Code (markup): This way you have the results in the $contents variable. If you execute this php script in a crontab you have what you need.
Thanks Sgthayes... but one question. I am using the feedwordpress plugin and it requires me to open the update-feeds.php page and click submit everytime i want to update my blog. I think the real meat of the line of cURL i got from the FeedWordpress site was the " -d update=quiet" part at the end. he mentioned that it was the part of the code that did a $post on the page which in turn got the feeds updated. basically - where in the code above that you posted would i put these switches? Thanks... green for you for your very quick response...
if the update=quiet are post vars it would go like this : $ch = curl_init('http://www.website.com/feed.php'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERPWD, $remote_login.':'.$remote_password); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, 'update=quiet'); $contents = curl_exec($ch); curl_close($ch); Code (markup): Have a look at the php curl docs for more info. Especially look at the curl_setopt() function. That's where all the good stuff is