Jump to content
  • 0

I want to insert a real-time update of VTC members' numbers for my website, but I'm running into a problem


Wannnggg

Question

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:

image.png.f26f0440f118fa1a88a8be44f3744460.png

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:

1592590117_.png.4db33b25746734568c9fef0483d0897d.png.eb41f9e68166d23ab62b260fed80776c.png

Reverse proxy my domain to http://ip:9900 and it did the trick

 

Html code:

318545955_.png.9c4a36cb118e74eece68ca6b0436dc27.png.62e0c463d77265b7adf7d3b13cfcd119.png

 

I tried to get it directly using php code, but it still failed.

Php code:

1524309959_.png.feb2edf9d3292706f8f37e74e4429090.png.83f8bfd938b430117f32bbbb2ed59924.png
echo "URL: {$url}".PHP_EOL;

 

Error: failed to get response (http status code: 0)

 

It's amazing, I've tried several methods

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

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

  • HaulieLove 1
Link to comment
Share on other sites

  • 0

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

  • 0

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

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.