473,394 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how do you suppress errors produced by file()


I'm getting this error:

<b>Warning</b>:
file(http%3A%2F%2Fwww.publicpen.com%2Fupdate.php%3 FcbHeadline%3DTestimonials%26amp%3BcbDateCreated%3 D%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?

Aug 18 '05 #1
3 1561
<lk******@geocities.com> kirjoitti
viestissä:11**********************@g47g2000cwa.goo glegroups.com...

I'm getting this error:

<b>Warning</b>:
file(http%3A%2F%2Fwww.publicpen.com%2Fupdate.php%3 FcbHeadline%3DTestimonials%26amp%3BcbDateCreated%3 D%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 <et****************@5P4Mgmail.com>
Aug 18 '05 #2
>You should not urlencode the domain part. This here:
http%3A%2F%2Fwww.publicpen.com%2Fupdate.php %3F should not be
encoded, thatshould be plaintext http://www.publicpen.com/updat e.php? so you
urlencode
just the query part.


Thanks, that's useful.
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.


No actually, an ampersand by itself is not allowed in any part of the
url. In the url, you have to use &amp;, not "&". You can not get your
pages to validate if you are using "&".

Aug 19 '05 #3
<lk******@geocities.com> kirjoitti
viestissä:11*********************@o13g2000cwo.goog legroups.com...
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/updat e.php? so you
urlencode
just the query part.


Thanks, that's useful.
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.


No actually, an ampersand by itself is not allowed in any part of the
url. In the url, you have to use &amp;, not "&". You can not get your
pages to validate if you are using "&".


Yes, it is allowed in url. It's not allowed in HTML code, but _is_ allowed
in the url, and in fact you have to use it instead of &amp;. The html code
gets fucked if & is found without an entity, but when you click on a link,
the browser converts &amp;'s to plain &'s. When you are accessing a remote
file with the file() function, you HAVE TO use the plain & url. You don't
have to believe me, but I'm not making this shit up, I know this for a fact.
I guess you have to screw it up yourself to believe.

--
SETI @ Home - Donate your cpu's idle time to science.
Further reading at <http://setiweb.ssl.berkeley.edu/>
Kimmo Laine <et****************@5P4Mgmail.com>
Aug 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: lawrence | last post by:
This line: if (file_exists($fileName)) { is (on some web servers) giving me this kind of error: Warning: SAFE MODE Restriction in effect. The script whose uid is 1022 is not allowed to...
6
by: Krishna Srinivasan | last post by:
I have a form with check boxes. When accessing a check box element that is not checked, I get a notice (Notice: Undefined variable..). Is there a way to hide these notices and warning in PHP code...
4
by: | last post by:
I want to write all produced error messages (error, warning, notify, etc...) to STDERR. Is this possible without writing my own error handling routine?
4
by: David Peach | last post by:
Hello, hope somebody here can help me... I have a query that lists defects recorded in a user defined date range. That query is then used as the source for a Cross Tab query that cross-tabs count...
1
by: Dan | last post by:
In a VS.NET 2003 project automatically generating the XML documentation on build I have some .CS files which lack comments as they are automatically created by tools (such as strongly typed DataSet...
3
by: Fergus Cham | last post by:
Dear All, I'm writing a VB.NET application to automate the process in Excel file. I wanna know how to suppress the prompting of Excel Error Message and write to logfile instead. Thanks &...
6
by: Ron St-Pierre | last post by:
Is there a way 'within' psql to suppress output? One of our cron scripts calls a sql file which contains various database commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions....
14
by: fdu.xiaojf | last post by:
Hi, I'm writing a program which imports an external module writing in C and calls a function provided by the module to do my job. But the method produces a lot of output to the stdout, and this...
2
by: ZeeHseez | last post by:
Hi, I have written a webbrowser application in VB .net Framework 1.1. I would like to suppress javascript error messages. However, the silent property of the webbrowser control suppresses the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.