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

Socket read from webpage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ecca
Sexy Santa
Join Date: Jan 2011
Old 12-26-2011 , 12:34   Socket read from webpage
Reply With Quote #1

Hello, well i just learned SQL fully in SM so i want to learn socket as a new work. I want to like read a webpage and do like

HTML Code:
If(htmlpageexist){
blabla
}
So i want to read a text of a webpage with socket can someone give me an example or link a guide where i can learn it
__________________
ecca is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 12-26-2011 , 13:50   Re: Socket read from webpage
Reply With Quote #2

The socket extension comes with examples on how to read a webpage, did you even look at that?
__________________
pheadxdll is offline
ecca
Sexy Santa
Join Date: Jan 2011
Old 12-26-2011 , 13:50   Re: Socket read from webpage
Reply With Quote #3

Ye it only show how i download the page, i just want to read and then check if it exist or not
__________________
ecca is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 12-26-2011 , 14:09   Re: Socket read from webpage
Reply With Quote #4

The important part is the OnSocketReceive, the first part will be the http header and it will look something like this:
Code:
HTTP/1.1 404 Not Found\r\n
therefore..
PHP Code:
public OnSocketReceive(Handle:socketString:receiveData[], const dataSizeany:hFile) {
     new 
iIndex StrContains(receiveData"404");
     if(
iIndex != -&& iIndex 30)
     {
          
// File doesn't exist
     
}
     
CloseHandle(socket); // Close since we are only interested in reading the http header

__________________
pheadxdll is offline
ecca
Sexy Santa
Join Date: Jan 2011
Old 12-26-2011 , 15:19   Re: Socket read from webpage
Reply With Quote #5

Thanks, but where did you get this code from? or where can i learn?
__________________
ecca is offline
Russianeer
SourceMod Donor
Join Date: Feb 2011
Old 12-26-2011 , 16:26   Re: Socket read from webpage
Reply With Quote #6

I don't think you will find anything with detailed description on HTTP sockets on this forum. I'd first learn how HTTP sockets work, and then using the extension will come easy to you.
Russianeer is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 12-26-2011 , 18:17   Re: Socket read from webpage
Reply With Quote #7

It's better to use either the cURL or SteamTools extensions for HTTP downloads rather than implementing it yourself.
__________________
asherkin is offline
Reply



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 09:34.


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