November 28th, 2006, 11:07 AM
Fopen Invalid argument error. What does it mean?
I am receiving the following error and don't understand why.
Is there something wrong with the url that I am using in the fopen.
First few lines of the script include:
Please help, thanks!
$durl = "misc/netshopsaffiliates.php?table=hammocks";
$sourced = fopen("$durl", "r");
November 28th, 2006, 11:50 AM
"misc/netshopsaffiliates.php?table=hammocks" is not a valid file name/path. You can use fopen() on "misc/netshopsaffiliates.php" though (if the path is correct).
Edit: Could you explain please what you are trying to do ?
Last edited by SKDevelopment; November 28th, 2006 at 11:54 AM.
November 28th, 2006, 12:01 PM
if you want to pass in parameters to another php script like that then you're going to have to fopen it by its full URL(with http:// and all that). This is the slow method that you really only do if you have to execute something on a remote server. If it is on the same server, it is just superfluous overhead. You can probably rework the program to work with an include or require.
November 28th, 2006, 12:35 PM
I have a script that is located within the root of my server so it can't really be viewed by the web browser. With this script, it then pulls datafeeds from a remotely hosted database. Each $table variable is a different datafeed. I have to open each one after each other and do things with the information and then insert into my database.
Originally Posted by SKDevelopment
The things is it will be much easier if I could either do it the way that I am trying or if it will work some how with http:// as I have hundreds of different urls and I can't make an extra script just for this merchant's products.
I will now work on something.
Thanks for your help.
November 28th, 2006, 01:38 PM
you can do [PHPNET="define"]define[/PHPNET]("table","hammocks") and [PHPNET="require"]require[/PHPNET] or [PHPNET="include"]include[/PHPNET] a file above the webroot. Then in that file, you have the constant table defined and you can do something based on that.
Comments on this post
November 28th, 2006, 02:12 PM
I have sorted it out now. I have just moved the php file above the root and am now using a full url that includes http://
It now works just fine.
November 28th, 2006, 04:41 PM
no it doesn't
if the file is above the webroot, it is inaccessible through the http:// scheme. No matter how hard you try, you aint going to get it. If you mean it is in another web accessible directory then yes it will work but it adds unneeded overhead that could easily be eliminated by a simple include. Also this eliminates the security that you would get if the script was above the webroot. Anybody on the net can now hit the netshopsaffiliates.php file.
November 28th, 2006, 05:26 PM
Thanks. I have now used the include as described and put it back into an none accessible directory.