Author |
|
flyred Newbie
Joined: October 28 2005 Location: United States
Online Status: Offline Posts: 10
|
Posted: November 14 2005 at 21:30 | IP Logged
|
|
|
Hi folks,
In the documentation, it talks about some sample PSP pages. I don't seem to have these available on my drive. Where are they supposed to be located? Is there somewhere to get a copy of them?
Thanks
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 15 2005 at 07:50 | IP Logged
|
|
|
Dave said this a bit ago...
Quote:
I havent included any of the PSP examples in the betas since I havent had a chance to update the code with all the latest changes.
Ive gone back through and pulled the PSP code for the main webpage and updated it so that it would at least work. It only pulls the X-10 devices and uses the layout that was in use before the last beta, but it works and should be a fairly thorough example of PSP in action.
You can download the file at http://www.power-home.com/download/pspsample.zip.
It contains three files. Unzip them into your PowerHome web directory and then launch your browser and bring up http://127.0.0.1/index.psp. This will bring up a PSP version of the X-10 status screen. The playmacro.psp and x10button.psp files support the playing of macros from the index.psp page and the controlling of the X-10 devices. |
|
|
There is also a fair bit of PSP code posted here.
|
Back to Top |
|
|
dmoreno Newbie
Joined: February 15 2002 Location: United States
Online Status: Offline Posts: 31
|
Posted: December 14 2005 at 18:57 | IP Logged
|
|
|
Hey Dave, is there a way to get the current host name? I tried using ph_getwebheaderparm command but I dont think it works exactly like the ASP's Request.ServerVariables("REMOTE_ADDR"). I have searched high and low through web and forum. Just can't find any info. My DLink will not allow me to cross my firewall then re-enter . To allow service to both intranet and internet I use the request.servervariable in my url links. Is this possible in PH?
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 15 2005 at 18:23 | IP Logged
|
|
|
Don,
I think the function you're looking for is ph_getwebremoteip(). It doesnt give you the hostname, but it's what I use for the problem you mentioned above. Im able to determine pretty quickly if Im hitting the PH webserver from an internal address (192.168.0.???) vs an external one.
HTH,
Dave.
|
Back to Top |
|
|
dmoreno Newbie
Joined: February 15 2002 Location: United States
Online Status: Offline Posts: 31
|
Posted: January 12 2006 at 22:04 | IP Logged
|
|
|
Hey Dave, I tried this command, but it gives me the clients IP Not the servers IP. So, If I am on 192.168.0.100 and I access server on 192.168.0.120. The browser access's 192.168.120 and where the command ph_getwebremoteip() in the page,it is telling me 192.168.0.100. So is there a way to get the server address from a remote location?
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 12 2006 at 22:47 | IP Logged
|
|
|
I'm confused. You're trying to get the IP of the server from a remote location? Wouldn't you need to know it to get there in the first place?
If you want PH to know what it's external IP is, you could do a ph_geturl("http://www.cocoontech.com/services/ip.php"). You would need to strip out the header info, though.
Let me know if we're both missing something.
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: January 13 2006 at 01:54 | IP Logged
|
|
|
Just have PH do:
ph_saveurl ( "http://www.whatismyip.com", ip.htm", 1 )
ph_readfile("ip.htm")
just have PH read the Title-section of the page and store this in a GV....
(more code needed after this naturally if you just need the IP)
here you'll see the remote IP-address... With some more code you can do anything you like with it... there is also an option to have the IP copied to the clipboard...
Peter
Edited by krommetje
|
Back to Top |
|
|
dmoreno Newbie
Joined: February 15 2002 Location: United States
Online Status: Offline Posts: 31
|
Posted: January 13 2006 at 12:36 | IP Logged
|
|
|
I have 2 web servers running. One for my web cam and one for my powerhome. We'll say power home is on port 1000 and let say web cam server is port 1001. I have DDNS servvice. I go to my powerhome from browser. On my index.psp, I have a link to my webcam server. Now in ASP you would enter the hyperlink command: < %= Request.ServerVariables("REMOTE_ADDR") % >. this way I could link a button with http://< %= Request.ServerVariables("REMOTE_ADDR") % >:1001/index.html. This comes in useful because my dlink has high built-in security. IT will not allow me to go through the WAN and come back in to retrieve my web page. Therefore My webpage is not accessable from the LAN side. Using the remote_addr, My website is accessible from intranet and internet.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 13 2006 at 12:59 | IP Logged
|
|
|
So if you try to access your page via the external name/IP from inside, the router won't allow it? Interesting. I guess I'm lucky (or not) that my dlink allows this.
I think using ph_getwebheaderparm("Referer") should do what you want after stripping out the port number and "index.html"...
|
Back to Top |
|
|
dmoreno Newbie
Joined: February 15 2002 Location: United States
Online Status: Offline Posts: 31
|
Posted: January 19 2006 at 22:05 | IP Logged
|
|
|
Thx Tony. Will try it as soon as I get PH back up. Had to redo windows.
|
Back to Top |
|
|