'game_receive_url_response' Pulling wrong data

Users who are viewing this thread

Jazora

Squire
Hello all, Ive encountered a problem with 'game_receive_url_response'. If anyone can point me in the right direction as I am completely new to php.

Module Scripts:
Code:
  ("game_receive_url_response",
    [
      #here is an example usage
##      (store_script_param, ":num_integers", 1),
##      (store_script_param, ":num_strings", 2),
##      (try_begin),
##        (gt, ":num_integers", 4),
##        (display_message, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),
##      (try_end),
##      (try_begin),
##        (gt, ":num_strings", 4),
##        (display_message, "@{s0}, {s1}, {s2}, {s3}, {s4}"),
##      (try_end),

      (store_script_param, ":num_integers", 1),
      (store_script_param, ":num_strings", 2),


		(display_message, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),
		(server_add_message_to_log, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),

      ]),

Code:
     (str_store_player_username, s1, ":player_no"),
     (player_get_unique_id, reg1, ":player_no"),
     (server_add_message_to_log, "@http://www.Testingwebsite.co.uk/datatest.php?playername={s1}&id={reg1}"),
     (send_message_to_url, "@http://www.Testingwebsite.co.uk/datatest.php?playername={s1}&id={reg1}"),


Data being pulled:
Code:
 01:31:50 - Jazora_Dowe has joined the game with ID: 10008 
 01:31:52 - http://www.Testingwebsite.co.uk/datatest.php?playername=Jazora_Dowe&id=10008 
 01:31:55 - 53000, 20, 100, 0, 0 
 01:32:04 -  <img=ico_headshot> Jazora_Dowe

And the php code:

Code:
<?php
include 'data/config.php';
include 'data/opendb.php';

$playername = $_GET['playername'];
$id = $_GET['id'];


$query="SELECT * FROM userinfo WHERE playername='{$playername}' AND playerid='{$id}'";

$result=mysql_query($query);

	while($person = mysql_fetch_array($result))   {
	echo $person['PlayerId']."|";
	echo $person['Money']."|";
	echo $person['Test1']."|";
	echo $person['Test2']."|";
}

include 'data/closedb.php';
?>

Any help is much appreciated.
 
Try this.

Code:
<?php
	while( $person = mysql_fetch_array( $result ) )
	{
		echo $person['PlayerId'].'|'.
			$person['Money'].'|'.
			$person['Test1'].'|'.
			$person['Test2'];
		
		/*echo $person['PlayerId']."|";
		echo $person['Money']."|";
		echo $person['Test1']."|";
		echo $person['Test2']."|";*/
	}
?>



Also, you're returning 4 values, so..
Code:
		(display_message, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),
		(server_add_message_to_log, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),
should be
Code:
		#(display_message, "@{reg0}, {reg1}, {reg2}, {reg3}"), #No message is displayed anyway.
		(server_add_message_to_log, "@{reg0}, {reg1}, {reg2}, {reg3}"),



And this..
Code:
     (player_get_unique_id, reg1, ":player_no"),
..should be this..
Code:
     (player_get_unique_id, ":unique_id", ":player_no"),
    (assign, reg1, ":unique_id"),
 
Jazora said:
Code:
  ("game_receive_url_response",
    [
      (store_script_param, ":num_integers", 1),
      (store_script_param, ":num_strings", 2),


		(display_message, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),
		(server_add_message_to_log, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),

      ]),

Code:
     (str_store_player_username, s1, ":player_no"),
     (player_get_unique_id, reg1, ":player_no"),
     (server_add_message_to_log, "@http://www.Testingwebsite.co.uk/datatest.php?playername={s1}&id={reg1}"),
     (send_message_to_url, "@http://www.Testingwebsite.co.uk/datatest.php?playername={s1}&id={reg1}"),
the warband code is correct - I would do the following steps:
1. check your webserver logfile, see if the page request does indeed arrive, also, check if the status code is correct (200). if it arrives, copy it from the log and paste it in your browser, so you can be sure that's not the reason for failing. (My guess is that the underscore gets replaced with a space, check that one out)
2. show the num_integers and num_strings values in your log - if, for some reason, the website fails to show a proper response, it would probably be 0 integers, 1 string (iirc)
3. show the first 4 strings {s0} to {s4} - maybe it's simply a PHP error, which would then show in the log
4. I think that one got fixed, but you can give it a try; tell the php page not to compress the page, because warband cant receive compressed html sites, only plain ones. (it's some header() command)



 
Thank you for the reply Theoris and Chaz

Theoris said:
Try this.

Code:
<?php
	while( $person = mysql_fetch_array( $result ) )
	{
		echo $person['PlayerId'].'|'.
			$person['Money'].'|'.
			$person['Test1'].'|'.
			$person['Test2'];
		
		/*echo $person['PlayerId']."|";
		echo $person['Money']."|";
		echo $person['Test1']."|";
		echo $person['Test2']."|";*/
	}
?>



Also, you're returning 4 values, so..
Code:
		(display_message, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),
		(server_add_message_to_log, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),
should be
Code:
		#(display_message, "@{reg0}, {reg1}, {reg2}, {reg3}"), #No message is displayed anyway.
		(server_add_message_to_log, "@{reg0}, {reg1}, {reg2}, {reg3}"),



And this..
Code:
     (player_get_unique_id, reg1, ":player_no"),
..should be this..
Code:
     (player_get_unique_id, ":unique_id", ":player_no"),
    (assign, reg1, ":unique_id"),

This seemed to work, Thanks for you help.
 
Theoris said:
And this..
Code:
     (player_get_unique_id, reg1, ":player_no"),
..should be this..
Code:
     (player_get_unique_id, ":unique_id", ":player_no"),
    (assign, reg1, ":unique_id"),
That's the same thing, no need to use an intermediate local variable.
 
There was a post somewhere on TW where someone had a issue when using a register as a destination and sending it to a webpage.
 
Ive just ran into another strange response with the logs.

Logs:
14:30:44 - Jazora_Dowe has joined the game with ID: 10008
14:30:45 - http://www.Testingwebsite.co.uk/datatest.php?playername=Jazora_Dowe&id=10008&playerno=21
14:30:50 - 10008, 3000, 0, 0, 210

The php code is returning the correct data, php code:

Code:
<?php
include 'data/config.php';
include 'data/opendb.php';

$playername = $_GET['playername'];
$id = $_GET['id'];
$playerno = $_GET['playerno'];


$query="SELECT * FROM userinfo WHERE playername='{$playername}' AND playerid='{$id}'";

$result=mysql_query($query);

	while($person = mysql_fetch_array($result))   {
      echo $person['PlayerId'].'|'.
         $person['Money'].'|'.
         $person['Test1'].'|'.
         $person['Test2'].'|';
      
      /*
      echo $person['PlayerId']."|";
      echo $person['Money']."|";
      echo $person['Test1']."|";
      echo $person['Test2']."|";
      */
}

      echo $playerno;

include 'data/closedb.php';
?>

Module Scripts:
Code:
      #(display_message, "@{reg0}, {reg1}, {reg2}, {reg3}"), #No message is displayed anyway.
      (server_add_message_to_log, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),

Code:
     (str_store_player_username, s1, ":player_no"),
     (player_get_unique_id, ":unique_id", ":player_no"),
	 (assign, reg1, ":unique_id"),
     (assign, reg2, ":player_no"),
	 (server_add_message_to_log, "@http://www.Testingwebsite.co.uk/datatest.php?playername={s1}&id={reg1}&playerno={reg2}"),
     (send_message_to_url, "@http://www.Testingwebsite.co.uk/datatest.php?playername={s1}&id={reg1}&playerno={reg2}"),

If anyone can share any light upon why its added a '0' to the player number it will be much appreciated.
 
Just to show the data is outputting properly:


*UPDATE*

I believe I am either echo'ing it incorrectly as it seems to produce a random number, example from logs:


00:03:11 - http://www.Testingwebsite.co.uk/datatest.php?playername=Jazora_Dowe&id=10008&playerno=4
00:03:15 - 10008, 1000, 0, 0, 24

Any help much appreciated.
 
Theoris said:
Code:
      #(display_message, "@{reg0}, {reg1}, {reg2}, {reg3}"), #No message is displayed anyway.
Messages using that operation are always displayed: to the server console for dedicated servers, and the normal place for clients.
 
Back
Top Bottom