I wrote a simple PHP script and uploaded it to a website hosted on epizy. The script itself just generates a short string and echoes it. It was my understanding based on a youtube tutorial that if I called urlfetch in a Nightbot command targeting that webpage, then the script would be ran, the text would be generated and it would be sent as a response to the urlfetch, which would then display it in Twitch chat. However, it keeps telling me that the response is longer than 400 characters, even with a test script that’s literally only this:
This is not super important, but I’d try to get it to work properly in the near future anyway. Can I get some help troubleshooting this please? I can’t really find any documentation on what’s going on behind the scenes, so I don’t have a lot to go on
Note: I’m not 100% sure it’ll work, might need to tweak the code a bit. Edit: as expected, it doesn’t work, check my next reply for a working code.
If it’s longer than 2400 characters don’t forget to add an ending parameter to the last .slice(), and you’ll have to get the full message in few commands.
If it’s shorter, update the second $(urlfetch) to your needs.
Here’s the second $(urlfetch) I used when empty, the messages separation is ` (backticks), it supports a maximum of 6 messages:
Thank you for the quick answer. The first one just gave me an “Error connecting to remote server.” The second one stated “Right hand side of instanceof is not an object”, which is odd, because “instanceof” is not part of any of the code I’m running.
I replaced the URL, yes :). With the new code it’s Error connecting to remote server a few times then Error connecting to webeval service. If it’s a server side issue I can’t do much, I just started an account on a free webhosting service and uploaded the files there. At least when I open the site in a browser, it works, I know that much.
Hmm, to me it looks like it’s a server issue then, because I did a test with a service I know to be working and I don’t get the error, I’m afraid I can’t help you more than this, I’m sorry, but maybe the others providing help will have more insight than me on the matter.
Hiya, without knowing the url you’re trying to fetch it’s hard to say what’s wrong, however a free webhost sometimes injects some extra code (for tracking for example) in your page.
You check check the page-source in the browser, to see if it’s just plain-text with no html tags. Or post the url here so I can test it.
Thanks for the response, I’ll check it out. The website isn’t a secret: marchofthepancakes dot epizy dot com slash index dot php (sorry about this formatting, but apparently no links in posts…), I just checked the source and it’s purely the text I want… Also, I tried the simple urlfetch again, and now I’m getting the Error Connecting to Remote Server thing.
An error connecting to your server means that the connection was rejected for whatever reason. It could be your server is blocking our request, the server is down, or an error was returned from the server.
Ah I forgot to test this for you. But yes, it is not working with the hosting you are using. In the browser it works fine, however there seems to be a sort of protection/security to block requests from non browsers.
When I try to request your website through cURL it returns a html page with an error: