B Tutorial Other Webserver as database for warband

Currently Viewing (Users: 0, Guests: 1)

Alphα

Section Moderator
WBWF&SNW
Best answers
0
Hello,
Big up now  :twisted:

I've an issue with the send_message_to_url function : nothing happened.

Code:
(try_begin),				
					(send_message_to_url, "@http://alphas-projects.com/content/ng_stats.php?unique_id={reg2}&local_id={reg0}&username={s2}&event=0"),
I need some help with that, does the function still exist ?
 

The_dragon

Master Knight
WBNW
Best answers
0
Yes, the operation still exists.

Idk what the problem could be. Start debugging step by step to see what fails where:
1. make sure that send_message_to_url gets executed. Put (display_message, "@Sent stuffs to webserver") after send_message...; if the message appears in game or in server's console, then this is not what failed; if no message appears, then you are not calling scripts or stuffs
2. make sure that the webserver receives the request; look into webserver's logs for recent access; if you don't have access to the logs, then modify ng_stats.php to create a file when it is accessed. If the file gets created after you see the debug message, then this is not what failed. If no file is created, then here is your problem. Make sure that your server's ip has access to ng_stats.php. If it still fails, then idk. Try debugging using a normal web browser.
3. make sure that the php file should do what you want it to do. Test it using a web browser. If the php returns values, manually check them if they are good (they should appear in the web browser)
 

Alphα

Section Moderator
WBWF&SNW
Best answers
0
The_dragon said:
Yes, the operation still exists.

Idk what the problem could be. Start debugging step by step to see what fails where:
1. make sure that send_message_to_url gets executed. Put (display_message, "@Sent stuffs to webserver") after send_message...; if the message appears in game or in server's console, then this is not what failed; if no message appears, then you are not calling scripts or stuffs
2. make sure that the webserver receives the request; look into webserver's logs for recent access; if you don't have access to the logs, then modify ng_stats.php to create a file when it is accessed. If the file gets created after you see the debug message, then this is not what failed. If no file is created, then here is your problem. Make sure that your server's ip has access to ng_stats.php. If it still fails, then idk. Try debugging using a normal web browser.
3. make sure that the php file should do what you want it to do. Test it using a web browser. If the php returns values, manually check them if they are good (they should appear in the web browser)
Thanks for your answer.
I've created a simply value in a databse which is incrementing for each time the page is loaded. So if the script send a request to this page I will be able to see the number was increased.
I'm going to debug. I keep u informed.

Regards,
Alpha
 

Ra'Jiska

Subforum Moderator
WF&SWBNWM&BVC
Best answers
1
PitchPL said:
Hey I have issue with this script

When I do same code , working database I got this in server logs after player joined.

https://pastebin.com/M62DqDqi


Some logs from httpd acces logs


https://pastebin.com/wcF9ZpkM
Make sure to encode the request before sending it (there is a MSYS operation for that, can't remember which one) so it replaces characters such as "_" with properly formatted sequences.
As a fast-fix, you can try changing the "unique_id" GET param with "uniqueid".
 

Pitch

Sergeant at Arms
WBNWVCM&BWF&S
Best answers
8
Ra'Jiska said:
PitchPL said:
Hey I have issue with this script

When I do same code , working database I got this in server logs after player joined.

https://pastebin.com/M62DqDqi


Some logs from httpd acces logs


https://pastebin.com/wcF9ZpkM
Make sure to encode the request before sending it (there is a MSYS operation for that, can't remember which one) so it replaces characters such as "_" with properly formatted sequences.
As a fast-fix, you can try changing the "unique_id" GET param with "uniqueid".

unfortunately fast fix doesn't work . Can you teach me how I can use encode operation in my case? I never use this.



I found only this in modsys

str_encode_url                  = 2355 # (str_encode_url, <string_register>),

send_message_to_url                  = 380 # (send_message_to_url, <string_id>, <encode_url>), #result will be returned to script_game_receive_url_response
 

Ra'Jiska

Subforum Moderator
WF&SWBNWM&BVC
Best answers
1
PitchPL said:
unfortunately fast fix doesn't work . Can you teach me how I can use encode operation in my case? I never use this.



I found only this in modsys

str_encode_url                  = 2355 # (str_encode_url, <string_register>),

send_message_to_url                  = 380 # (send_message_to_url, <string_id>, <encode_url>), #result will be returned to script_game_receive_url_response
The `str_encode_url` is the one. But if the quick fix doesn't work, there is little chance the encode fix does the trick.
You may want to catch the full HTTP request for debugging.
 

Pitch

Sergeant at Arms
WBNWVCM&BWF&S
Best answers
8
Ra'Jiska said:
PitchPL said:
unfortunately fast fix doesn't work . Can you teach me how I can use encode operation in my case? I never use this.



I found only this in modsys

str_encode_url                  = 2355 # (str_encode_url, <string_register>),

send_message_to_url                  = 380 # (send_message_to_url, <string_id>, <encode_url>), #result will be returned to script_game_receive_url_response
The `str_encode_url` is the one. But if the quick fix doesn't work, there is little chance the encode fix does the trick.
You may want to catch the full HTTP request for debugging.


https://pastebin.com/GRQDXsBy
 

Pitch

Sergeant at Arms
WBNWVCM&BWF&S
Best answers
8
Ra'Jiska said:
PitchPL said:
There are still spaces in your HTTP message.
I've been trying a sample HTTP request with space between params and I ended up, just like you, with a 400 status code.


Now code is clean but when I join to server I dont see anything new in my MySQL

https://pastebin.com/vXshKBmJ



I have same logs even if I turn of MySQL





Current progres : mySQL base work good , gold are shown on phpmyadmin . Probably last bug - I have 250 gold on database but after reconnect I gave 1 gold in game/on database ;c
 

Ra'Jiska

Subforum Moderator
WF&SWBNWM&BVC
Best answers
1
PitchPL said:
Now code is clean but when I join to server I dont see anything new in my MySQL

https://pastebin.com/vXshKBmJ

I have same logs even if I turn of MySQL





Current progres : mySQL base work good , gold are shown on phpmyadmin . Probably last bug - I have 250 gold on database but after reconnect I gave 1 gold in game/on database ;c
For these questions it's all up to you and how you've coded your system.
 

pete99

Squire
Best answers
0
Is there anywhere you can get a comparable web server for free? Or at least for a cheap price?
 

Namakan

Master Knight
M&BWBWF&SNWVC
Best answers
4
There are a lot of free webhosts, with a bit of searching you can probably find one fit for your use.
 

pete99

Squire
Best answers
0
Also, does this work for online rented servers or just dedicated servers? Everything seems to work fine, but Gold isn't showing up when I rejoin. Any possible fixes?