RE: [PHP-GENERAL] [PHP3] Sending POST variables

From: Date: Mon, 22 May 2000 02:36:23 +0000
Subject: RE: [PHP-GENERAL] [PHP3] Sending POST variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-265@lists.php.net to get a copy of this message
Here's what I do to ping a web site automatically to see if it still exists. After splitting the $path and $host from the URL using parse_url(): $sock = fsockopen($host, $port)); set_socket_blocking($sock, 1); $request="HEAD $path HTTP/1.0\r\n"; $request.="HOST: $host\r\n"; $request.="\r\n"; fputs($sock, $request); Then I do a bunch of fgets($sock) to read the result. Note that I'm doing a "HEAD" request here, because I'm only testing if the page is actually there. If you want the whole page, do a GET instead. If you want to send post data, I think you just add "variable=value" lines before the blank line that signals the end of the request header. > From: Harry Forbess [mailto:harry@forbess.com] > > Hi, well, I wrote a script that does just what you are saying. Only for > altavista though. I got the url unobfuscated from samspade.org and I just > plugin the new info. Heres what I do, if you know the whole url > just assign > it to say $URL then > > > $myfile =fopen($URL,"r"); where URL is some crazy crap like, > > http://www.altavista.com/cgi-bin/query?pg=aq&q=php+and+web+develop > ment&r=&kl > =XX&d0=&d1=&search.x=21&search.y=1 > > >From my limited experience, this will make it so you dont have to worry > about post or get, you just "open" > > harry > -----Original Message----- > From: Benton Jackson <goatrider@goatrider.com> > To: spider <noone@nowhere.com>; php-general@lists.php.net > <php-general@lists.php.net> > Date: Sunday, May 21, 2000 5:42 PM > Subject: RE: [PHP-GENERAL] [PHP3] Sending POST variables > > > >If you are accessing the web page via script, you are probably already > >sending an HTTP header (if there's an easier way, nobody's told me). The > >post data is there. I think it's just lines with "variable=value". > > > >> From: spider [mailto:noone@nowhere.com] > >> > >> How does one send values to a server by the POST method from > >> a PHP-script? I want to send queries to search engines and recieve > >> the output file from the search engine; the problem is that some > >> search engines' pages have forms using the POST method and their > >> scripts only take POST-variables. I know that GET variables are sent > >> simply by putting a '?' after the URL and separating the variables by > >> an '&'. > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >For additional commands, e-mail: php-general-help@lists.php.net > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#265) next »