Raised This Month: $ Target: $400
 0% 

Read XML files


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
miki208
Junior Member
Join Date: Aug 2011
Old 04-25-2012 , 18:20   Re: Read XML files
Reply With Quote #10

Tnx you man
I made plugin 'weather'. When u type /weather city_name, socket must to connect and send data to php script and get answer. That's work. I tested my plugin on server which is hosted on my computer. And that's work only when i type /weather city, but other players can't. Is it possible that sockets only can to connect from my computer, only from IP adress of my server, and how to resolve this problem? :/
PHP Code:
//plugin_init
register_concmd("say","s",0,"plugin");
//s function is called when someone activate say command, and check is it starts with '/weather', and connect socket
//i note that only I can to can to call this function, but i want to all players can
public s(id

    
// Connect 
    
new DATA[1000];
    new 
komanda[50];
    
read_argv(id,komanda,sizeof(komanda));
    new 
naredba[50];
    
strtok(komanda,naredba,49,argument,49,' ');
    
replace_all(argument,49," ","%20");
    if(
contain(komanda,"/weather")==0)
    {
    new 
errorsendbuffer[512
    
g_Socket socket_open("serbia-chat.net16.net"80SOCKET_TCPerror
  
     
    
// Send page request 
    
format(sendbuffer511"GET /prognoza.php?grad=%s HTTP/1.1^nHost:serbia-chat.net16.net^r^n^r^n",argument
    
socket_send(g_Socketsendbuffer511
     
     
    
// Setting the tasks for handeling the response 
    
set_task(1.0"task_waitanswer"TASKID_GETANSWER""0"a"15
    
set_task(16.0"task_closeconnection"TASKID_CLOSECONNECTION""0""0
   }
   

miki208 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode