Server PHP problem

Soldato
Joined
18 Oct 2002
Posts
10,188
In another thread I created a function that uses a get_header() on a url to find out song names from a streaming service. It works well, however I have encountered a problem on my hosting that I cannot solve.

It is on Stablepoint, I have contacted their chat support and I must say I am very very very disappointed in their help, so much so I have had to turn to here. They claim that the code is at error. I have tested this is not the case as I have 2 hosting comapanies and it works on the other and on my local...

What I cannot work out is what is the problem on Stablepoint. I am using the same PHP versions, 7.3.
There are a lot of Extension options i can enable but I do not know what any of them do.
The problem seems to be with the function calling the url, which is being blocked somehow or not working at all. It is not returning any data for the javascript to update the DOM. Initially it just returned a 500 error, I have since tried a different method and that doesn't return any data at all, both suffer from not being able to get the data from the URL.

I really am at a total loss what to do. Stablepoint won't help, they keep suggesting I use their sister company wordpress-fix (or something), but I know it's not my code. I have checked the error logs but nothing is showing up there either.

Any suggestions would be greatly appreciated.
 
I'll contact Darren, thanks

I'll try to answer the question you said.

Do you mean PHP's function 'get_headers()' (https://www.php.net/manual/en/function.get-headers.php)? Yes, but I'm not even sure that's the problem. I have a function that can use 3 different methods and none of them seems to get through to the url
https://github.com/KO-N/Mp3StreamTitle/blob/master/Mp3StreamTitle.php


Have you checked the PHP log file to see what error is being thrown? If so, what's the error?
You might need to set the error reporting level to 'E_ALL', which you can do via PHP.ini.
I have checked the php settings and they are meant to be send error logs to the cpanel error file but I cannot see any at all, has made me wonder if the server is being blocked rather than blocking

Also, does the "url" you're calling have a valid SSL certificate (if you're using HTTPS)? yes it does but im using http
As you can run into issues with invalid certificates which will throw an error; although you can pass options stream context options (using stream_context_create()) to get_headers() to try and get around them.


Edit - IIRC, get_headers() relies on allow_url_fopen being enabled and some hosts disable this by default; can easily check via phpinfo() or looking at your PHP.ini file.
I've checked in the php ini and its enabled
 
Darren has managed to sort this for me. Appreciate him going the extra mile. Handy having someone from Stablepoint on the forum. I'll try not to ask to many questions. :D
 
Last edited:
Back
Top Bottom