Goto page Previous  1, 2, 3  Next

● Discord Module

Tue Sep 26, 2023 10:03 pm
Clan Leader
Top Dog
Nuke Dev / Coder
3018 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 89.7hrs.
Total Played: 435hrs.


  
There is life outside of the game.
Reputation: 7326.8
votes: 7
n/p
Wed Sep 27, 2023 6:28 pm
NOOB!!!
8 Posts
Reputation: 9.6
Greetings, I have the same problem as original post with block looking like :
Please login to see this link
Get registered or Log in
also. What ports other than 80 and 443 needs to be open?


+ edited, never mind. Lonestar told me that it uses a curl call.
Fri Sep 29, 2023 12:37 pm
Clan Leader
Top Dog
Nuke Dev / Coder
3018 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 89.7hrs.
Total Played: 435hrs.


  
There is life outside of the game.
Reputation: 7326.8
votes: 7
yeup, that it does use a curl, so no ports would need to be opened.


 
Fri Sep 29, 2023 10:58 pm
NOOB!!!
8 Posts
Reputation: 9.6
Lonestar's discord module did work, but I am hoping to use your version because I personally like the layout of yours better. (no offense to Lonestar!) And I would really like to figure out why the latest version is not displaying for me. On my live site (evo-E) I am using your original release, and it is fine. I am cloning my site using evo F at a test site and trying your latest version. I do have java and curl installed and am using php7.4 on Ubuntu 20.04. Any thoughts on what I might be missing or can learn to aid in figuring out what I am doing wrong?   Thanks for your time and efforts coRpSE and sorry to bother you with this post.

$php -version
PHP 7.4.3-4ubuntu2.19 (cli) (built: Jun 27 2023 15:49:59) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
   with Zend OPcache v7.4.3-4ubuntu2.19, Copyright (c), by Zend

$java -version
openjdk version "11.0.20.1" 2023-08-24
OpenJDK Runtime Environment (build 11.0.20.1+1-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.20.1+1-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

$curl -V
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets


 
Sat Sep 30, 2023 8:39 am
Clan Leader
Top Dog
Nuke Dev / Coder
3018 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 89.7hrs.
Total Played: 435hrs.


  
There is life outside of the game.
Reputation: 7326.8
votes: 7
daveran27703 Do any other cURL's work on your site?

I see that you have the cURL extensions installed, but have you done a phpinfo(); to verify that it is enabled?

PHP:  [ Select all ]

<?php
phpinfo
();
?>


You can run a test script. I put one together that worked fine for me trying to make sure it worked on my local:

PHP:  [ Select all ]

<?php

// URL to test (something like your Discords widget .json URL)
$url 'PUT YOUR URL HERE';

// Initialize cURL session
$ch curl_init($url);

// Set cURL options
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_SSL_VERIFYPEERtrue); // Verify SSL certificate
curl_setopt($chCURLOPT_SSL_VERIFYHOST2);    // Verify host name in certificate

// Execute cURL request
$response curl_exec($ch);

// Let's check for cURL errors
if (curl_errno($ch)) {
 
   echo "cURL Error: " curl_error($ch);
} else {
 
   // Let's check for SSL certificate errors
 
   $sslInfo curl_getinfo($chCURLINFO_SSL_VERIFYRESULT);
 
   if ($sslInfo === 0) {
 
       echo "SSL Certificate OK <br />";
 
   } else {
 
       echo "SSL Certificate Error (Code: " $sslInfo ") <br />";
 
   }

 
   // Let's check HTTP status code (200 OK)
 
   $httpCode curl_getinfo($chCURLINFO_HTTP_CODE);
 
   if ($httpCode === 200) {
 
       echo "HTTP Status Code: 200 OK <br />";
 
   } else {
 
       echo "HTTP Status Code: " $httpCode "<br />";
 
   }
}

// Close cURL session
curl_close($ch);

echo 
'<br /><br />' $response//Show the contents
?>

 
Just put that code into a blank PHP file, put in your Discord's widget URL, then place that file into the root of your site and then point your browser towards it.
If you see:

SSL Certificate OK
HTTP Status Code: 200 OK

At the top of the page with a bunch of info under it, then that would eliminate the SSL verify as an issue. That is an issue I had with my local WAMP server not being able to read SSL certs.

Here is the post I made about it:
Please login to see this link
Get registered or Log in


You can also attempt to try that line of code I put in that post to see if that works. Thought that was for steam, it will be the same for the Discord module except that my Discord module uses the cURL for Evo, and that is found in the file public_html/includes/functions_evo_custom.php.

Just do a search for cache_json_data and in that function, you should see what I mentioned in that post.

I am just trying to do a process of elimination to hopefully solve this.


 
Sat Sep 30, 2023 10:32 am
NOOB!!!
8 Posts
Reputation: 9.6
I PM'ed you with link to your test script. I believe it returned the expected response.  I am not on a localhost, but on a VPS from Ionos. I don't think I have any SSL or DNS faults. (Pm to you in my outbox got edited for more info depending on when / if viewed). I am scared it will be something my fault, which statistical odds suggest is a high probability  augen rollen


 
Sat Sep 30, 2023 11:32 am
Clan Leader
Top Dog
Nuke Dev / Coder
3018 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 89.7hrs.
Total Played: 435hrs.


  
There is life outside of the game.
Reputation: 7326.8
votes: 7
Yup, I replied to your PM with another suggestion, basically, making sure that permissions are right. The way my system works is, it will first check to see if the cached file exist and is newer than X time. If the file doesn't exist, or is older X time, then it will make the cURL call and put the info into a cached file.

Once it puts the info into the cached file, the system then reads off of that cached file. By doing it this way, it save on it making a cURL on every page reload, which will in turn save your site and Discord's from getting too many API calls.

Now, we have determined that your site is allowing the API calls and is able to display the information, so that leads me to think that it is not either allowing the creation of the cache file, which would be the folder permission that I put in that PM, or, the file permissions, which would block the ability to write the info from the curl into that file.


 
Sat Sep 30, 2023 12:52 pm
NOOB!!!
8 Posts
Reputation: 9.6
yes, it is a permissions issue! I temp made the discord/cache a 777 -r and it works.


 
Sat Sep 30, 2023 1:42 pm
Clan Leader
Top Dog
Nuke Dev / Coder
3018 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 89.7hrs.
Total Played: 435hrs.


  
There is life outside of the game.
Reputation: 7326.8
votes: 7
Yeah, just set it to 755 instead of 777. For security reasons, you shouldn't have that with that permission.
But glad to hear that we were able to get this solved and its working.


 
Sat Sep 30, 2023 2:23 pm
NOOB!!!
8 Posts
Reputation: 9.6
thanks coRpSE  actually I had it at 745, but I will make it 755 like you said. Your explanation of how it works was very helpful along with your direct suggestions of course.  Hopefully others will benefit from todays efforts also.


 
Goto page Previous  1, 2, 3  Next
Forums ©