!iamwannngg Posted October 26, 2023 Share Posted October 26, 2023 I want to insert a real-time update of VTC members' numbers for my website, but I'm running into a problem: At first what I thought of was to use insert Html code and then directly insert the members_count value in https://api.truckersmp.com/v2/vtc/{vtcid}/members Code: Error:(Cause: CORS header 'Access-Control-Allow-Origin' is missing). Status code: 403 Then I used python to set it up on my server, and then accessed my own api through the reverse proxy. It was indeed successful, but it was a bit slow: Py code: Reverse proxy my domain to http://ip:9900 and it did the trick Html code: I tried to get it directly using php code, but it still failed. Php code: echo "URL: {$url}".PHP_EOL; Error: failed to get response (http status code: 0) It's amazing, I've tried several methods Profils | Rule | Report | Feedback Link to comment Share on other sites More sharing options...
0 LogRol Posted October 26, 2023 Share Posted October 26, 2023 Hello, On all of the pictures you have provided you have failed to replace {VTCID} which is required to be able to fetch proper data. If you open your VTC's page on the website, in the url, you will see what is your VTC's id. By checking your profile, https://truckersmp.com/vtc/61001 you are in this VTC, which means the VTCID you need to provide is 61001. Here is the answer reported back by TruckersMP API: https://codebeautify.org/jsonviewer/y23280a02 Let us know if this helped, Kind Regards, LogRol Game Moderator 1 Link to comment Share on other sites More sharing options...
0 !iamwannngg Posted October 26, 2023 Author Share Posted October 26, 2023 @LogRol I know, I'll replace it with my VTCID when I actually use it.but thank you! Profils | Rule | Report | Feedback Link to comment Share on other sites More sharing options...
0 Almeida. Posted October 27, 2023 Share Posted October 27, 2023 Hello @!iamwannngg, In view, did you find your best answer? Your confirmation helps us to keep the Forum organized. Kind regards, øAlmeida TruckersMP Support 1 Link to comment Share on other sites More sharing options...
0 !iamwannngg Posted October 27, 2023 Author Share Posted October 27, 2023 I haven't found a good solution yet Profils | Rule | Report | Feedback Link to comment Share on other sites More sharing options...
0 JJay Posted November 1, 2023 Share Posted November 1, 2023 Hello, Your topic has been inactive for 3 days since the last reply. Because of inactivity, I will have to move this topic to Inactive Topics. If you still have any questions about this, feel free to DM me or our support team members, we will open this again. Kind Regards, JJay TruckersMP Support & Language Forum Moderator //Locked and Moved to Inactive Nie ma magicznych skrótów do rozwiązania Twoich problemów. | Ban appeal | Complaints / Feedback | TruckersMP Rules | Join the Team | Link to comment Share on other sites More sharing options...
0 JJay Posted November 12, 2023 Share Posted November 12, 2023 Hello there, I am going to move this topic to the Unsolved Section because it has been inactive again for a week. Do not hesitate to contact us again by creating another topic or a support ticket! Kind Regards, JJay TruckersMP Support & Language Forum Moderator // Moved to Unsolved Nie ma magicznych skrótów do rozwiązania Twoich problemów. | Ban appeal | Complaints / Feedback | TruckersMP Rules | Join the Team | Link to comment Share on other sites More sharing options...
Question
!iamwannngg
I want to insert a real-time update of VTC members' numbers for my website, but I'm running into a problem:
At first what I thought of was to use insert Html code and then directly insert the members_count value in https://api.truckersmp.com/v2/vtc/{vtcid}/members
Code:
Error:(Cause: CORS header 'Access-Control-Allow-Origin' is missing). Status code: 403
Then I used python to set it up on my server, and then accessed my own api through the reverse proxy. It was indeed successful, but it was a bit slow:
Py code:
Reverse proxy my domain to http://ip:9900 and it did the trick
Html code:
I tried to get it directly using php code, but it still failed.
Php code:
echo "URL: {$url}".PHP_EOL;
Error: failed to get response (http status code: 0)
It's amazing, I've tried several methods
Profils | Rule | Report | Feedback
Link to comment
Share on other sites
6 answers to this question
Recommended Posts