Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi,
Im using WSA to connect to a php page and read from it. I get the headers also in the output which i want to remove, but not the text, so im attempting to look for "\r\n\r\n" in the array and working back from there.

Heres what i got:

C++
char	ReadData[ 512 ];

for( int i = 0; i < sizeof( ReceivedData ); i++ )
{
    if( ReceivedData [i] == '\r' && ReceivedData [i+1] == '\n' && ReceivedData [i+2] == '\r' && ReceivedData [i+3] == '\n' )
    {
        ReceivedData [i] += 4;
        DataSize -= 4;
    }
}


The above returns

C++
HTTP/1.1 200 OK
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-Powered-By: PHP/5.3.10
X-Powered-By: ASP.NET
Date: Wed, 16 Jan 2013 12:26:41 GMT
Connection: close
Content-Length: 12

Test Message


All i want is

C++
Test Message


Have i missed something obvious?

Thanks
Posted
Updated 16-Jan-13 2:00am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900