include_once problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thedarkdestroyer
Forum Newbie
Posts: 9
Joined: Thu Sep 28, 2006 9:27 am

include_once problem

Post by thedarkdestroyer »

I have downloaded an example script from a company that I use. I have installed openssl and curl as specified but when i run their example scripts I get the following errors:

Warning: include_once(/EsendexAccountService.php) [function.include-once]: failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\Esendex\Example Files\EsendexAccountServiceExample.php on line 3

Warning: include_once() [function.include]: Failed opening '/EsendexAccountService.php' for inclusion (include_path='.;C:\php5\pear') in C:\Program Files\Apache Group\Apache2\htdocs\Esendex\Example Files\EsendexAccountServiceExample.php on line 3

Fatal error: Class 'EsendexAccountService' not found in C:\Program Files\Apache Group\Apache2\htdocs\Esendex\Example Files\EsendexAccountServiceExample.php on line 11

I know the file is definatley there.

I havent had a great deal of experience with include_once or with the $accountService commands so I am probably doing something stupid.
Here is the script i am using, any help would be great, thanks.

Code: Select all

<?php

include_once ('/EsendexAccountService.php');

//Test Variables:
$username = 'someusername';		//Your Username (normally an email address)
$password = 'password';			//Your Password
$account = '1234567';			//Your Account Reference (either your virtual mobile number, or EX account number)

//instantiate the service with login credentials
$accountService = new EsendexAccountService($username, $password, $account);

//get the message limit for the account
print_r ( $accountService->GetMessageLimit() );
?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

include_once ('/EsendexAccountService.php');
/ stands for "root directory". Sure you want to include /EsendexAccountService.php?

What does

Code: Select all

echo 'file: ', __FILLE__, "<br />\n";
include_once ('/EsendexAccountService.php');

//Test Variables:
$username = 'someusername';          //Your Username (normally an email address)
$password = 'password';   //Your Password
$account = '1234567';         //
//...
print?
thedarkdestroyer
Forum Newbie
Posts: 9
Joined: Thu Sep 28, 2006 9:27 am

Post by thedarkdestroyer »

When you say root directory do you mean C:\ or do u mean the www or htdocs folder?

PS where did you get the

Code: Select all

echo 'file: ', __FILLE__, "<br />\n";
from???? it dosent exist on my code that I posted??

cheers
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

sorry, typo
__FILE__, see http://www.php.net/manual/en/language.c ... efined.php

thedarkdestroyer wrote:When you say root directory do you mean C:\ or do u mean the www or htdocs folder?
ah, a win32 system. Yes, root of the current drive, C:\ or D:\ or E:\ or .....
On a unix-like system there is a single root directory, root of all the other files and directories, no drives.
thedarkdestroyer
Forum Newbie
Posts: 9
Joined: Thu Sep 28, 2006 9:27 am

Post by thedarkdestroyer »

But i dont see:

__FILE__,


anywhere in my code???

Sorry if I am being a bit thick here!!!!!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Post Reply