Re: how do you suppress errors produced by file()



<lkrubner@xxxxxxxxxxxxx> kirjoitti
viestissä:1124333726.903172.289640@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> 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 .=
> "&amp;cbMainContent=$cbMainContent";
> $url .= "&amp;cbDateCreated=$cbDateCreated";
> $url .= "&amp;cbUserName=$cbUserName";
> $url .= "&amp;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 &amp; 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@xxxxxxxxxxxxx>


.



Relevant Pages

  • Re: how do you suppress errors produced by file()
    ... >>You should not urlencode the domain part. ... >> in the query itself, so let's change em back to plain &'s. ... It's not allowed in HTML code, ...
    (comp.lang.php)
  • Re: how do you suppress errors produced by file()
    ... >You should not urlencode the domain part. ... >should be plaintext http://www.publicpen.com/updat e.php? ... > in the query itself, so let's change em back to plain &'s. ... > encode them either. ...
    (comp.lang.php)
  • URL Encode via SQL?
    ... Is there a way to tell SQL to URLEncode the string before ... returning it in the query? ...
    (microsoft.public.sqlserver.programming)
  • UPDATE: I Need to replace many text area in a field with replace f
    ... Just to Give you an update, by creating multiple queries it worked. ... uberblick wrote: ... I should a create a single Query per attribute name that I'd ... I have a generic HTML template for ebay that contains html code. ...
    (microsoft.public.access.queries)
  • Re: I Need to replace many text area in a field with replace funct
    ... uberblick wrote: ... I should a create a single Query per attribute name that I'd like to replace. ... I have a generic HTML template for ebay that contains html code. ...
    (microsoft.public.access.queries)