Re: Opening a socket and sending GET data
| From: | Todd Cary | Date: | Fri, 22 Nov 2002 23:05:42 +0000 |
| Subject: | Re: Opening a socket and sending GET data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125689@lists.php.net to get a copy of this message | ||
Chris -
I seem close, but I am still getting a clobbered "page". For debugging, I sent the query to a file so that I can check it moer accurately and this is what I am getting (for readability, I added the CRLF after the "?" in this email):
GET http://209.204.172.137:80/_calendar/php/selectevent.php?
pa_county%3D%26reenter_page%3D1%26sel_from_mo%3DNovember
HTTP/1.0
Accept-Language: en-us
Host: 209.204.172.137:80
Connection: close
if (!empty($request)) {
$path = $path . "?" . urlencode($request) . "\r\n";
}
//Use the echo below to test
//echo('Path: ' . $path . '<br><br>');
# build the absolute URL
$abs_url = "http://$host:$port$path";
//Use the echo below to test
//echo('Abs_url: ' . $abs_url . '<br><br>');
# now we build our query
$query = "GET $abs_url" .
"HTTP/1.0\r\n" .
"Accept-Language: en-us\r\n".
"Host: $host:$port\r\n".
"Connection: close\r\n";
Todd
Chris Shiflett wrote:
--- Todd Cary <todd@aristesoftware.com> wrote:-- Ariste Software, Petaluma, CA 94952I must be missing something because when I execute the following code, open the socket, and send the query, the form that the info is going to gets created but it is corrupted. Do you see any obvious error?Yes, I do. It was likely due to a misinterpretation of my response caused by wrapping. The request line needs to be like this: GET $url HTTP/1.1\r\n$query = "GET $abs_url\r\n" . "HTTP/1.0\r\n" .You have these on two separate lines here. Chris .