Using External URL in Custom Plugin
-
I am creating a custom plugin for my website.I need to call an API to fetch some details from an external server.
The API function worked correctly in localhost.I also checked the API response through Postman.
I also tried to call the API with wp_remote_get().It also didn’t worked.
This is the code I used.Any help.
$service_url = 'external url'; $curl = curl_init($service_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $curl_response = curl_exec($curl); $decoded = json_decode($curl_response,TRUE); print_r($decoded);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Using External URL in Custom Plugin’ is closed to new replies.