SA-MP Forums Archive
HTTP request - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: HTTP request (/showthread.php?tid=316020)



HTTP request - SDraw - 05.02.2012

Hello,
I try to improve my FS for online radio. I needed to make HTTP request to URLs of radios. I tried to get request from working radio and broken radio. But I always get only response "1". Please, tell me. Is it real to make request, or HTTP system for SA-MP isn't so improved?


Re: HTTP request - T0pAz - 05.02.2012

Show us the code you've made so far.


Re: HTTP request - SDraw - 05.02.2012

Ok, I'll tell with more information...
Is it really to get response code for avaliable streaming over HTTP?
Example:
PHP Code:
#include <a_samp>
#include <a_http>
forward Check(indexresponse_codedata[]);
public 
OnFilterScriptInit()
{
    
HTTP(-1,HTTP_GET,"http://ice.somafm.com/xmasinfrisko","","Check");
    
HTTP(-1,HTTP_GET,"http://78.159.104.167:80","","Check");
    return 
1;
}
public 
Check(indexresponse_codedata[]) return printf("Index - %d, response code - %d, data - %s",index,response_code,data); 
First radio doesn't work. Response code - 1. But in Winamp (and others media players) response code is 404.
Second radio works. But response code is 1 too.
If change HTTP_GET to HTTP_HEAD response code will be 1 too...
How to be?