|
Posted by Kimmo Laine on 08/18/05 06:41
<lkrubner@geocities.com> kirjoitti
viestissδ:1124333726.903172.289640@g47g2000cwa.googlegroups.com...
>
> I'm getting this error:
>
> <b>Warning</b>:
> file(http%3A%2F%2Fwww.publicpen.com%2Fupdate.php%3FcbHeadline%3DTestimonials%26amp%3BcbDateCreated%3D%26amp%3BcbUserName%3D%26amp%3BpageAddress%3Dhttp%3A%2F%2Fwww.publicdomainsoftware.org%2Fgo%2Findex.php%3FpageId%3D33119):
> failed to open stream: No such file or directory in
> <b>/home/httpd/vhosts/publicdomainsoftware.org/httpdocs/go/pdsIncludes/CommandUpdatePublicPen.php</b>
> on line <b>64</b><br />
>
>
>
> these are lines 56-64:
>
>
>
> $url = "http://www.publicpen.com/update.php";
> $url .= "?cbHeadline=$cbHeadline";
> if ($cbHeadline == "") $url .=
> "&cbMainContent=$cbMainContent";
> $url .= "&cbDateCreated=$cbDateCreated";
> $url .= "&cbUserName=$cbUserName";
> $url .= "&pageAddress=$pageAddress";
>
> $url = urlencode($url);
> $arrayOfPublicPenResponse = file($url);
>
>
>
> I don't get the urlencode thing. The file is there, I've checked many
> times, so am I getting an error that says it isn't there?
You should not urlencode the domain part. This here:
http%3A%2F%2Fwww.publicpen.com%2Fupdate.php%3F should not be encoded, that
should be plaintext http://www.publicpen.com/update.php? so you urlencode
just the query part. And another thing: you use & in html code, but not
in the query itself, so let's change em back to plain &'s. Plus you should
encode them either.
To achieve this, modify your code a bit:
$url = "http://www.publicpen.com/update.php?";
$query = urlencode("cbHeadline=$cbHeadline");
if ($cbHeadline == "") $query .=
'&'.urlencode("cbMainContent=$cbMainContent");
$query .= '&'.urlencode("cbDateCreated=$cbDateCreated");
$query .= '&'.urlencode("cbUserName=$cbUserName");
$query .= '&'.urlencode("pageAddress=$pageAddress");
$arrayOfPublicPenResponse = file($url.$query);
Now your handling the URI and the query string separately and encoding just
the query parameters.
--
SETI @ Home - Donate your cpu's idle time to science.
Further reading at <http://setiweb.ssl.berkeley.edu/>
Kimmo Laine <eternal.erectionN0@5P4Mgmail.com>
Navigation:
[Reply to this message]
|