Forum Moderators: open

Message Too Old, No Replies

Communicate with PHP

         

pedge

10:23 pm on Nov 8, 2005 (gmt 0)



Hi,
i need to proved a PHP page to a remote server to a non technical user. so i need to give them some code which is very easy to impliment. like a javascript that calls my php. this i can do easily, the tricky part is that i need to re-call this php script with different parameters. ie. i would need to call mypage.php?pageID=123&subPageID=456 and this needs to update the clients page without reloading. i tried using DOM but when i try to write the returned html i get Object HTMLscriptElement.

i dont think iframes are a good idea as its across domains and in addition i still need javascript to write before php is processed which cannot be done. this is because i need to get the domain of the page with the iframe to validate it.

the only solution i see is php include but i am not sure if this could update the client page dynamically.

the real problem is that i need to keep the php on my server in order to protect my code and only give out the html.

any advise would help

thanks
Pedge

willybfriendly

10:38 pm on Nov 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are doing this to protect your code, then you should probably look at an encoder so your scripts are running on your client's server. Zend offers one, but it is spendy (~$950). I think there are third party programs that cost less.

As far as updating a page without reloading it - well, good luck. AJAX might offer some options relevant to your needs, but I am not familiar enough with it to be anymore specific.

WBF

whoisgregg

2:41 am on Nov 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I posted some XMLHttpRequest object sample code in a thread over in PHP land [webmasterworld.com] that may be helpful to you. (msg #9)

Basically the hooks are there to have your PHP code return "anything" and have it processed through javascript. It'd take only a little more work to have it return complex data structures. It's a little single record focused right now. :-/

(I bet there's folks here in the Javascript forum that have much better sample code for doing AJAX stuff.)