Jellyfin Forum
Issue Using php script for api call - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Development (https://forum.jellyfin.org/f-development)
+--- Forum: Client Development (https://forum.jellyfin.org/f-client-development)
+--- Thread: Issue Using php script for api call (/t-issue-using-php-script-for-api-call)



Issue Using php script for api call - Ahmad Arif - 2024-04-28

I make php script for calling the endpoint of user.But its still return only null.Not any response in kind of error.


File Attachment.


RE: Issue Using php script for api call - ermineglug - 2024-10-23

(2024-04-28, 08:00 AM)Ahmad Arif Wrote: I make php script for calling the endpoint of user.But its still return only null.Not any response in kind of error.
File Attachment.

Hey there! Here are a few troubleshooting steps you can try to identify the problem:

  1. Check the Endpoint URL: Ensure that the URL you're calling is correct. A small typo can lead to a null response.
  2. Enable Error Reporting: Add "error_reporting(E_ALL);" and "ini_set('display_errors', 1);" at the beginning of your script to display any potential errors that might be hidden.
  3. Inspect Response: If you’re using "file_get_contents()" or "cURL", check if you're capturing the response correctly. For cURL, make sure to include "curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);" to get the response as a string instead of outputting it directly.
  4. Headers and Payload: Confirm that you’re sending the correct headers (like "Content-Type") and payload if required by the endpoint.
  5. API Authentication: If the endpoint requires authentication (like an API key or token), make sure you're passing it correctly.

If you share your code, I might be able to provide more specific advice!