cURL request to plugin repository fails 403

Thanks to the WordPress forums someone answered that this only works via PHP if you set the UserAgent to a browser. $ua=”Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13″; curl_setopt( $cd, CURLOPT_USERAGENT, $ua);

Error: Can´t access facebook comment plugin admin page

I had to change the plugin file to make it work. I think it can help someone and even the plugin’s author should consider making these changes. on class-admin.php, create this function at the beggining (can be line 9): function loadXmlByCurl($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $xml = … Read more

Accessing an API with jQuery and AJAX

There are a few things going on with your functions.php file that may be the issue. You should be using wp_enqueue_scripts action to enqueue your script. The first parameter of wp_localize_script() should match the id of the file you’ve enqueued. You also need to add a no_priv version for your Ajax call if it needs … Read more

Curl: disable certificate verification

Yeah, you can do that. From curl –help or man curl: -k, –insecure (SSL) This option explicitly allows curl to perform “insecure” SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered “insecure” fail unless -k, –insecure is … Read more

Use WordPress user database in external php application

If your main concern is using your WordPress database for user authentication, I’d look into the WP OAuth Server plugin. We use this for authentication with a 3rd party mobile app: app users type their username and password into the app which then – thanks to the plugin – authenticates them against their credentials in … Read more

Post to WordPress from another Server via PHP

I finally managed to accomplish the task using XML-RPC as suggested by denis.stoyanov. If xmlrpc is installed on your Server simply use the wpPostXMLRPC function from stackoverflow. But keep in mind that the used xmlrpc_encode_request() is an experimental function you usually would try to avoid.