Good Morning Forum,
I write my own PHP when I need specific tasks done. It has been quite a while and since I have had the need to write anything so I am rusty as can be.
I am needing some guidance and help and hope that I can acomplish what I am setting out to do with 2 hurdles I am trying to over come.
I am trying to embed a trivia game web page that takes a 5 digit code that logs you into a current game. The site uses multiple logins and a database to retrieve and store data once logged in. A game session can have up to 1000 users and it does not matter what device is used as long as it has internet and a browser. I am successful in pulling their index.php file into mine with all pictuteres, links and format in tact.
I have tried using JavaScript and iFrames but there is an issue with the cross domains and the permissions or security of some sort do not get passed properly using these two methods even though they keep the embeded site within my page.
I have the company's permission to embed their main page into mine, actually it was their suggestion. The whole idea is to make it look like my site using their login and server with my information so the end users do not know the real source of the site where there are links on how to purchase from them on the pages used.
Issues I have observed are with the JavaScript and iFrames are:
When logged, in the server loses connection with the remote device and even though the game can be played, it does not up date the server.
When logging out, the server keeps the connection active and even though the device logs out, the server app shows the client still logged in.
When a wrong code is entered, the error message does not show up on the device trying to log in.
Now this all goes away and the app works great running on their domain directly.
I am also under the impression that I can manipulate certain elements with in the raw data. I am hoping that I can manipulate their contact us link to redirect to my contact information. But I believe this all has to stay within my site to pull that data.
What I have accomplished is being able to load their main index.php into a basic page on my site with this code. I found it on another search earlier and it worked out of the chute. I do not quite understand curl.
<? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.theirsite.com"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch); curl_close($ch); $result = preg_replace("#(<\s*a\s+[^>]*href\s*=\s*[\"'])(?!http)([^\"'>]+)([\"'>]+)#",'$1http://theirsite.com/$2$3', $result); echo $result ?>
I used a more simple PHP code as well but this also worked and it was the last I code snippet I tried.
Once the page loads it is on my site in my domain. Once I enter the 5 digit code to join the game, it takes me from my site to theirsite.com and stays there.
How do I keep it all embeded in my site?
I have been researching this for about 8 hours now and this is as far as I have reached. Any help would be appreciated. I think PHP is the way to go with this.
Thanks. I look forward to the your responses.
Regards,
Paul