Re: curl and variable parameters in hyperlink
| From: | Adam Richardson | Date: | Wed, 24 Nov 2010 08:08:29 +0000 |
| Subject: | Re: curl and variable parameters in hyperlink | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309647@lists.php.net to get a copy of this message | ||
>
> foreach ($_POST as $key=>$post) {
> $post=str_replace(" ", "+", $post);
> $url.=$key."=".$post."&";
> }
>
Hi Bob,
One thing I see is that you're appending values on to the end of a url that
already has 2 values, so you should place the "&" at the beginning of your
line instead of at the end. Value 2 is being merged with whatever value is
coming after it in your example. So, try something like:
$url .= "&" . $key. "=" .$post;
Also, I'd suggest url encoding the post value rather than merely hunting
down spaces and swapping them out with "+".
Hope this helps,
Adam
--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com