Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

wordpress curl wp remote post timeout error

//this timeout error comes when request takes much time ti fetch response
//in such cases, simply use curl instead of wordpress request functions like wp_remote_post($url) or wp_remote_request($url)

$ch = curl_init();
 	curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($arguments));
    $response = curl_exec($ch);
    $result = json_decode($response);
    curl_close($ch); // Close the connection
 return $result;
 
PREVIOUS NEXT
Tagged: #wordpress #curl #wp #remote #post #timeout #error
ADD COMMENT
Topic
Name
4+5 =