Re: Problems with a PostToHost()-function

From: Date: Mon, 24 Jul 2000 06:36:07 +0000
Subject: Re: Problems with a PostToHost()-function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7828@lists.php.net to get a copy of this message
Hello Sascha, On 22-Jul-00 20:08:02, you wrote: >Hi! >I am trying to get a little bit less workload with the PostToHost-function. >Here is what I want to do: When someone signs up for my site and indicates >that we wants to get the newsletter, I need to post the data the user >submitted to two different hosts: >a) to my database >b) to topica.com >Right now I'd have to get the data I got by E-Mail (which is only an >e-mail-address) and enter it into a form from topica manually. >So, here is my code, which isn't working: Several things seem to be wrong. ><? >function PostToHost($host, $path, $data) { >$fp = fsockopen($host,80); >printf("Open!\n"); >fputs($fp, "POST $path HTTP/1.1\n"); Lines should be ended with \r\n . >$data = >"?digest=f&Submit=Submit&sublist=dummy@online-talks.de&invite=OPTOUT"; The ? should be ommited. While you are at it, you may want to try this PHP http client request class that does what you need and works properly. http://phpclasses.UpperDesign.com/browse.html/package/3 Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp --

« previous php.general (#7828) next »