504 Gateway Time-out error when making cURL request in WordPress

The documentation wants you to insert the proper values where they use double curly braces. To consume this API you must replace in the url {{{wolkvox_server}} by the nomenclature of the server of the operation. In your particular account, they will give you the values you need to subsitute, meaning the server name, the campaign … Read more

Inconsistencies between wp_remote_post and cURL

As discovered above, headers need to be (seems so obvious now) key-value pairs, as opposed to an array of json-style key-values: $headers = array(); $headers[‘Content-Type’] = ‘application/json’; $headers[‘Api-Key’] = ‘{myapikey}’; $headers[‘Siteid’] = ‘99999’; And the body needs to be json so either: ‘body’ => “{\n \”Username\”: \”Siteowner\”,\n \”Password\”: \”apitest1234\”\n}” or ‘body’ => json_encode(array( ‘Username’ => … Read more

Call external API in wordpress based on user input

s is a reserved keyword, you cannot reuse the URL parameters and query variables used by WordPress itself. This issue is unrelated to the API request code. Because your form has an input with the name s, the request is interpreted as a search request. As no posts were found in the WordPress search, you … Read more

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);

Difference between `curl -I` and `curl -X HEAD`

It seems the difference has to do with the Content-Length header and how it is treated by both commands. But before going into that, curl -X HEAD does not give any output because, by default, curl does not print headers if switch -i is not provided (not needed on -I though). In any case, curl … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)