• 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)
  • Are there any errors in the web server’s log file or in the PHP log file?

    You could try enabling detailed PHP error reporting by calling error_reporting( E_ALL ) at the top of your PHP code. This will cause any errors to appear in the site’s rendered HTML which may be useful for debugging the issue.

Viewing 1 replies (of 1 total)

The topic ‘Using External URL in Custom Plugin’ is closed to new replies.