Hi all,
I am using fsockopen to post a string to an external web site via the get method using the following code:
$fp = fsockopen("www.website.com", 80, $errno, $errstr, 30);
fputs($fp, "GET /friend.php?id=0123456&af=60067 HTTP/1.0\r\n");
fputs($fp, "Host: www.website.com\r\n");
fputs($fp, "Connection: Close\r\n\r\n");
while (!feof($fp)) {
$data .= fgets($fp, 1024);
}
echo "$data";
That works just fine in terms of opening a connection and returning the data but the problem it returns a whole load of data i don't need:
HTTP/1.1 200 OK Connection: close Date: Mon, 27 Feb 2006 18:27:24 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Length: 23 Content-Type: text/html Expires: Mon, 27 Feb 2006 01:47:23 GMT Set-Cookie: ASPSESSIONIDQADRBTBS=GIEGHLFBKKKFOHIBCEBBJOGC; path=/ Cache-control: private Confirmed - 2385056
The only bit i'm interested in is the bit right at the bottom that says 'Confirmed - 2385056'
If the full url was pasted into the browser the parsed page will only display 'Confirmed - 2385056'
Is there a way I can add something to my code to make fsockopen only return the parsed part of the page and forget all the other header info?
Thanks in advance