Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on a BackPress project where I need to schedule cron tasks. The cron_uri for BP is stored in options, rather than hardcoded as it is in WP core. I've tried setting the option to mysite.com/wp-cron.php (where wp-cron.php is essentially a copy of the same file from WordPress, modified to include only the relevant files to my purposes.

The problem is, when this address is called from the wp_cron() function, it returns the following fsockopen error:

fsockopen() [function.fsockopen]: unable to connect to :80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /home/gad/public_html/backpress/class.wp-http.php on line 646

I can open the cron uri directly using fsockopen and it doesn't return any error. As best as I can figure out, the problem is somewhere in the HTTP Transport API, maybe in the WP_http->request() function, where BackPress checks the cron_uri against the application_uri option, to see if the request is a local one or not (and possibly treat the different requests differently?).

Strangely enough, if I just set the cron_uri to my home url, it works fine - I can intercept the request based on the GET request and include wp-cron.php before outputting anything.

I'm mainly confused as to why wp_remote_post doesn't seem to work with this file, as it seems to work with most everything else I've tried to do with it.

share|improve this question
    
HAve you fixed this?I have the same problem and i need this to work both with cUrl and streams, because it's possible that people doesn't have cUrl installed –  Nicola Peluchetti Jul 17 '12 at 20:01
add comment

1 Answer

up vote 2 down vote accepted

From quick look at source mechanics seem very similar, my first suggestion for WP would be to try and bump HTTP transport to curl (I do it with plugin in WP so no idea about specific code).

curl seems to be considerably more robust for corner cases and it's not WP's first choice.

share|improve this answer
    
I tried searching for the plugin you mentioned, but I can't seem to find it. Whats it called? Link, maybe? –  goldenapples Mar 4 '11 at 19:28
    
@goldenapples ah, sorry, slipped me to link - Core Control. –  Rarst Mar 4 '11 at 19:59
    
Using curl did work for this case... but I ended up just hacking at the core to force it. Not my best coding moment. I did see the filters that Core Control uses, though, and I'll go back and try and apply those later. –  goldenapples Mar 19 '11 at 1:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.