[Ayuda] Problemas con HTTP_GET
#1

Hola, buenas noches, hoy intentaba obtener informaciуn del sitio web, pero me salta el siguiente error (respose_code): "HTTP_ERROR_MALFORMED_RESPONSE"

He buscado por todos los foros de SA-MP entre otros pero no he conseguir encontrar la soluciуn... Si me pueden ayudar estarнa muy agradecido.

Este es mi cуdigo:

Код:
#include <a_samp>
#include <a_http>
#include <core>

new Lugar[255];
//new Tiempo;
new timertiempo;

forward actualizartiempo();
forward TiempoWeb(index, response_code, data[]);

public OnFilterScriptInit()
{
    print("===== Tiempo Real =====");
    print("Actualizando... Puede tardar... ");
    Lugar = "Madrid";
    printf("=====> Tiempo Real =====> Lugar establecido a: %s", Lugar);
    printf("=====> Tiempo Real =====> Descargando tiempo...", Lugar);
    HTTP(1, HTTP_GET, "midominio.com/realtime/tiempo.php?lugar=Madrid", "", "TiempoWeb");

    //timertiempo = SetTimer("actualizartiempo", 1000, true); // Set a timer of 1000 miliseconds (1 second)
}

public OnFilterScriptExit()
{
    KillTimer(timertiempo);
}

public actualizartiempo()
{
    //print("1 second has passed.");
}

public TiempoWeb(index, response_code, data[])
{

    if(response_code == 200)
    {
        printf("The URL replied: %s", data);
    }
    else
    {
         printf("The request failed! The response code was: %d", response_code);
    }
}
Y tengo otra duda, їla pбgina que se debe cargar debe ser un .txt o puede ser .php y otros?
Reply
#2

Podrias mostrarnos que hace tu web al recivir esta peticion?
Reply
#3

Sн, aquн va mi cуdigo PHP:

PHP код:
<?php
$lugar 
$_GET['lugar'];
$xml simplexml_load_file ('http://www.******.com/ig/api?weather='.$lugar.'');
$information $xml->xpath("/xml_api_reply/weather/forecast_information");
$current $xml->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list $xml->xpath("/xml_api_reply/weather/forecast_conditions");
?>
<?php 
//echo $current[0]->condition['data'];
if($current[0]->condition[data] == "Clear"){ echo '0'; }
elseif(
$current[0]->condition[data] == ""){ }
elseif(
$current[0]->condition[data] == ""){ }
elseif(
$current[0]->condition[data] == ""){ }
else{ echo 
'0'; }
?>
EDITO: Era el antivirus que me bloqueaba el acceso a la pбgina mediante el servidor (Avast Antivirus) Tema Solucionado

Gracias de todas formas
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)