Raised This Month: $51 Target: $400
 12% 

[NATIVES] Socket HTTP.


  
 
 
Thread Tools Display Modes
Author Message
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 06-12-2011 , 23:16   [NATIVES] Socket HTTP.
#1

Descripción.
Permite pasar datos a paginas web usando el metodo GET y POST.
Tambien incluyó la native urlencode.


Natives:
PHP Code:
/*Envia datos a una web.Si recv es 0 la conexion se cierra y no se puede usar sock_http_recv.
Los datos tienen que estar en formato url.
Tip es el metodo,(HTTP_POST o HTTP_GET).
Dominio es la web.*/
native sock_http_send(tiprecv, const dominio[], const datos[], any:...)
 
/*
Obtiene los datos resividos.
Los parametros del handler son:
(sock, error, data[]).
*/
native sock_http_recv(sock, const handler[])
 
/*Combierte el texto de un string en formato url.*/
native urlencode(const inpu[], out[], len
Creditos:
DarkSnow: Tutorial "socket and webserver".
joropito: Stock urlencode.
antibots: Tutorial de natives y callfunc.
shinora: Ayuda con algunas dudas.

Attached Files
File Type: inc sock_http.inc (301 Bytes, 209 views)
File Type: sma Get Plugin or Get Source (sock_http.sma - 809 views - 3.1 KB)
File Type: sma Get Plugin or Get Source (test_sock_http.sma - 701 views - 845 Bytes)
__________________

Last edited by Destro-; 07-10-2012 at 11:27.
Destro- is offline
shinoda
Spanish Moderator
Join Date: Nov 2009
Location: ag_crossfire
Old 06-13-2011 , 23:30   Re: [NATIVES] Socket HTTP.
#2

Porque 'char' y callfunc ?
shinoda is offline
Send a message via MSN to shinoda Send a message via Skype™ to shinoda
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 06-14-2011 , 00:04   Re: [NATIVES] Socket HTTP.
#3

esta acostumbrado en C el pibe.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 06-14-2011 , 00:57   Re: [NATIVES] Socket HTTP.
#4

Quote:
Originally Posted by shinoda View Post
Porque 'char' y callfunc ?
Use callfunc porque quedava mas lindo xD,vos decis que lo cambie por un
forward.?

pd:Vi que en el amx studio "char" se ponea en verde,entonses se me dio por usarla como en c xD.

pd2:me olvide de cerrar el socket en el read :S.
__________________

Last edited by Destro-; 06-14-2011 at 01:01.
Destro- is offline
shinoda
Spanish Moderator
Join Date: Nov 2009
Location: ag_crossfire
Old 06-14-2011 , 01:33   Re: [NATIVES] Socket HTTP.
#5

Quote:
Originally Posted by Destro- View Post
Use callfunc porque quedava mas lindo xD,vos decis que lo cambie por un
forward.?

pd:Vi que en el amx studio "char" se ponea en verde,entonses se me dio por usarla como en c xD.

pd2:me olvide de cerrar el socket en el read :S.
callfuns también puede usarse en el mismo plugin (segun funcwiki), pero no significa que sea mejor forma, ya que generalmente se usa para interactuar con otros plugins. Con simples variables puedes hacer lo mismo.

Y 'char' no se usa como lo hiciste.
PHP Code:
// No es lo mismo hacer:
new test[5] = "test"

// que
char test[5] = "test" 
Esto es válido, no te lo puedo explicar porque aún no lo entiendo bien :/.
PHP Code:
new test[5 char] = !"test" 
Pawn Language Guide - pag 137 ^^.
shinoda is offline
Send a message via MSN to shinoda Send a message via Skype™ to shinoda
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 06-14-2011 , 09:38   Re: [NATIVES] Socket HTTP.
#6

Quote:
Originally Posted by shinoda View Post
callfuns también puede usarse en el mismo plugin (segun funcwiki), pero no significa que sea mejor forma, ya que generalmente se usa para interactuar con otros plugins. Con simples variables puedes hacer lo mismo.

Y 'char' no se usa como lo hiciste.
PHP Code:
// No es lo mismo hacer:
new test[5] = "test"
 
// que
char test[5] = "test" 
Esto es válido, no te lo puedo explicar porque aún no lo entiendo bien :/.
PHP Code:
new test[5 char] = !"test" 
Pawn Language Guide - pag 137 ^^.
o.O
Porque no es valido ?,no se supone que unas de las primeras cosas que hace el compilador es reemplazar los macros por su valor ?.

Ahora testeo para sacarme la duda xd.

@EDIT
Lo probe y es lo mismo :/,asta el .amxx es el mismo usando char o new.

PHP Code:
#include <amxmodx>
 
#define char new
 
public plugin_init()
{
    
char b[6] = "testB"

PHP Code:
#include <amxmodx>
 
#define char new
 
public plugin_init()
{
    new 
b[6] = "testB"

Entre los 2 .amxx no hay ni 1 byte de diferencia .
pd:diferencia de caracteres,no de tamaño xd.
__________________

Last edited by Destro-; 06-14-2011 at 10:08.
Destro- is offline
shinoda
Spanish Moderator
Join Date: Nov 2009
Location: ag_crossfire
Old 06-14-2011 , 21:15   Re: [NATIVES] Socket HTTP.
#7

No había visto el macro xd, de igual forma, 'char' tiene una función específica con los arrays, imagino que puede causar problemas, no lo sé ^^.
shinoda is offline
Send a message via MSN to shinoda Send a message via Skype™ to shinoda
Old 06-14-2011, 23:04
Destro-
This message has been deleted by Destro-.
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 07-10-2012 , 11:29   Re: [NATIVES] Socket HTTP.
#8

Fix timeout.


Versión modulo y un poco mas completo:
http://forums.alliedmods.net/showthread.php?t=189598
__________________
Destro- is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-10-2012 , 23:25   Re: [NATIVES] Socket HTTP.
#9

Quote:
Originally Posted by Destro- View Post
Fix timeout.


Versión modulo y un poco mas completo:
http://forums.alliedmods.net/showthread.php?t=189598
Si... estoy esperando que lo compiles (Es nuevo el gatito :B).
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
 



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 23:39.


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