Re: Automating POST/GET
| From: | Saulius | Date: | Mon, 26 Apr 2004 08:16:39 +0000 |
| Subject: | Re: Automating POST/GET | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184611@lists.php.net to get a copy of this message | ||
> I've tried ...
>
> <?php
> $siteurl = "www.whatever.com";
> $description = "Description with spaces and commas, in it.";
>
> include
> 'http://www.google.com/addurl?q=$siteurl&dq=$description';îã°léN
oµ‹u
> ÿ“N //
> Works - but passes the variable name instead of its value.Any variation
from
> this format doesn't work - such as double-quotes, periods, etc.
when you are forming quoted string expression with variables in it, you
should use double quotes
(http://www.google.com/addurl?q=$siteurl&dq=$description;) or single quotes,
but insert variables in other way:
'http://www.google.com/addurl?q='.$siteurl.'&dq='.$description;
> header("Location:
http://www.google.com/addurl?q=$siteurl&dq=$description")
> // Doesn't work - my IE6 browser won't make the remote call and instead
> errors out trying to execute this script locally.
> ?>
the error you are getting most probably is "Headers already sent in...".
this is because there cannot be any output before sending headers. that
includes spaces before "<?php" or anything. function header() must be the
first output in the script.
>
> Any help much appreciated...
>
> Ed