Locating Win32api

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
griffinmt
Forum Commoner
Posts: 35
Joined: Sun Jul 16, 2006 8:37 pm
Location: Michigan

Locating Win32api

Post by griffinmt »

I am just getting back to using php for some basic maintenance functions on my systems, and took a look at using the win32api functions (just what I want!). But it would seem that win32api is no longer supplied with php (5.3.3) for windows binaries.

Can anyone help me find it, or explain why is is not a good choice??

Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Locating Win32api

Post by requinix »

Try to use COM instead.

What kind of "maintenance"?
griffinmt
Forum Commoner
Posts: 35
Joined: Sun Jul 16, 2006 8:37 pm
Location: Michigan

Re: Locating Win32api

Post by griffinmt »

For example, reorganizing sets of pics (jpg) across two servers based upon exif content info. A task that is 'scheduled' to run in the middle of the night.

Doing application specific backups across LAN and compressing/decompressing the files on the fly.

etc

Also, could you post an example of connecting to a network share using COM? I can't figure out where to start!!!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Locating Win32api

Post by requinix »

griffinmt wrote:For example, reorganizing sets of pics (jpg) across two servers based upon exif content info. A task that is 'scheduled' to run in the middle of the night.
Okay, but why do you need the Windows API for that?
griffinmt wrote:Doing application specific backups across LAN and compressing/decompressing the files on the fly.
Ditto.
griffinmt wrote:Also, could you post an example of connecting to a network share using COM? I can't figure out where to start!!
As long as whoever PHP is running as (NetworkService, IUSR, etc) has access to the share you can just... use it. Windows will do the connecting.

Code: Select all

$handle = fopen("\\\\server\\share\\path\\to\\file", "r");
There's no built-in way for doing authentication so... I don't know, I'd have to do some research. The same research you would do.
griffinmt
Forum Commoner
Posts: 35
Joined: Sun Jul 16, 2006 8:37 pm
Location: Michigan

Re: Locating Win32api

Post by griffinmt »

All of that is fine if you know what you want in advance.
I want to be able to enumerate all connected shares, connect to the desired share if not connected on each target system, enumerated all folders and files on these connections (along with creation/modified date etc), and so on.
Martyn
griffinmt
Forum Commoner
Posts: 35
Joined: Sun Jul 16, 2006 8:37 pm
Location: Michigan

Re: Trying other ways!

Post by griffinmt »

For now, thought I would try using some other 'methods.
The 'client' side is W7 and the 'server' side is WXP (on an isolated Lan).

On XP there is a share defined (//Gate/Wanderer) with full controll access by all users (network and local).

On W7 I am running both Apache2.2 and IE8 as the 'client'.

The following is a simple chunk of code being tested"

Code: Select all

$baseout = "\\\\Gate\\Wanderer";
$dir = dir($baseout);
$dir->close();
When I launch this, I get the following:
Warning: dir(\\Gate\Wanderer,\\Gate\Wanderer): Access is denied. (code: 5) in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\dev\BakMine.php on line 20
Warning: dir(\\Gate\Wanderer): failed to open dir: No error in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\dev\BakMine.php on line 20
Fatal error: Call to a member function close() on a non-object in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\dev\BakMine.php on line 21
The last error is kind of obvious, but what are the likely causes for the first error?
Post Reply