We help IT Professionals succeed at work.

Complicated Transparent remote access site mashup

Last Modified: 2010-04-16

I have a webpage that will provide remote access to people using a service from a website called SkyFex. The client visits the webpage https://skyfex.com/client/ and is given a 6-digit number. They provide this to a helper who then remotely connects to the client. I want to provide this transparently through my site, so they see no skyfex branding (not concerned with the ethics at the moment, will solve that later.)

Here is the process I am currently using:
Open index.php with a blank iframe
index.php makes a background AJAX call to skyfex.php
skyfex.php uses a php curl proxy through godaddy.com's server (my hosted server) to open the page https://skyfex.com/client/ and sends bogus useragent information so the page will think the webserver is actually a browser(IE7).
the response page is sent back and stored in a variable
the variable to written to a php file named skyfexsession.php
change iframe src on index.php to skyfexsession.php, and find the div innerHTML which contains the 6-digit number and throw an alert with the number

I get the information back fine, but when you try to connect to that remote access on skyfex's site it does not work (error "client id not found"). I am assuming there is a problem with the php being ran from the page i am trying to receive from skyfex, or cookies, or something, I cannot be sure. Is there anyone brave enough to try to tackle this issue? Here is the code across the pages:

//////////////////      index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<iframe src="about:blank" style="visibility:hidden; position:absolute;height:500;width:250px" id="skyfexframe" name="skyfexframe"></iframe>
<script type="text/javascript">
function getothersite() {
    if (window.XMLHttpRequest) {
        http = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        http = new ActiveXObject("Microsoft.XMLHTTP");
        http.open("GET", 'skyfex.php', true);
        http.onreadystatechange = getxmlvalidate;
function getxmlvalidate() {
    if (http.readyState == 4) {
         myframe = document.getElementById('skyfexframe');
        myframe.src = "skyfexsession.php";
         setTimeout("getnumber()", 5000);
function getnumber() {
window.onload = getothersite;

////////////////////////     skyfex.php
$FULLURL = "https://skyfex.com/client/";
$useragent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)';
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt ($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128");
curl_setopt ($ch, CURLOPT_URL, $FULLURL);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close ($ch);
$result = str_replace('CODEBASE = "/download/SkyFexClient.cab#Version=1,0,2,106"','CODEBASE = "http://skyfex.com/download/SkyFexClient.cab#Version=1,0,2,106"',$result);
$phpfilename = "skyfexsession.php";
$phpfilehandle = fopen($phpfilename, 'w') or die("can't write file");
fwrite($phpfilehandle, $result);

///////////// example of what is written to skyfexsession.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   <Title>SkyFex Remote Assistant Client</title>
   <link rel="stylesheet" href="https://skyfex.com/styles.css" type="text/css">
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
   <script language="javascript" type="text/javascript" src="https://skyfex.com/js/strings.js"></script>
   <script language="javascript" type="text/javascript" src="https://skyfex.com/js/client.js"></script>
      <script language="javascript" type="text/javascript">
            bDebug = 0;
      <script for="skyClient" event="ActiveXMessage(id_message, text_message)" language="javascript" type="text/javascript">
      ActiveXMessage(id_message, text_message);
      <script for="skyClient" event="ActiveXResize(left,top,right,bottom)" language="javascript" type="text/javascript">
   <script language="javascript" type="text/javascript">
   function GetUrl()
            var a = document.URL;
            var i = a.length;
            for(i=0;a.charAt(i)!= '/' ;i++);
            for(i++;a.charAt(i)!= '/' ;i++);
            for(i++;a.charAt(i)!= '/' ;i++);
            var it = "";
            var j;
            for(j = 0;j <= i;j++)
                  it += a.charAt(j);
            //it += "c.xsl"
            //it = it.replace("https","http");
            return it;
<body id="client" onactivate="Initialize();" onbeforeunload="ConfirmExit();">
<!-- ********** noscript browser********** -->
    <DIV id="pnlNoJavaScript" style="BORDER-RIGHT: #f3cb6a 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f3cb6a 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #f3cb6a 1px solid; WIDTH: 472px; PADDING-TOP: 5px; BORDER-BOTTOM: #f3cb6a 1px solid; POSITION: relative; HEIGHT: 316px; BACKGROUND-COLOR: #fff4c3"
        align="left" ms_positioning="FlowLayout">
            Your browser is not allowed to start JavaScript.&nbsp;Please
            allow&nbsp;JavaScript to run&nbsp;SkyFex Remote Assistant.<BR>
                Windows 2003 Server</STRONG> users:<BR>
            If ActiveX is not started this means you have High security level for Internet.
            To start SkyFex Remote Assistant please add <A href="https://skyfex.com/client/">skyfex.com</A>
            to&nbsp;the Trusted Sites zone:</P>
            Open Tools-&gt;Internet Options...-&gt;Security
            Select 'Trusted sites' icon
            Click on the 'Sites...' button
            Click on the 'Add' button
            Click on the 'Close' button
            Click OK
                <STRONG>Reload</STRONG> this page</LI></UL>
<!-- ********** pnlSP2Instructions ********** -->
<DIV id="pnlSP2Instructions" style="  DISPLAY: none; WIDTH: 472px;   POSITION: relative; HEIGHT: 382px; " ms_positioning="GridLayout">
    <DIV         ms_positioning="FlowLayout" align="center">
    <STRONG>To start SkyFex Remote
            Assistant&nbsp;please follow these steps:</STRONG></DIV>
    <DIV >
    <IMG  alt="" src="https://skyfex.com/img/InstallDialog3_client_pro.gif">
<!-- ********** pnlInstructions ********** -->
<DIV id="pnlInstructions" style="  DISPLAY: none; WIDTH: 500px;   POSITION: relative; HEIGHT: 382px;" ms_positioning="GridLayout">
      <DIV         ms_positioning="FlowLayout" align="center">
      <STRONG>To start&nbsp;SkyFex Remote Assistant click on the 'Yes' button&nbsp;in this window.</STRONG>
      <DIV >
    <IMG  alt="" src="https://skyfex.com/img/InstallDialog2.gif">
<!-- ********** cookie ********** -->
<DIV id="box_cookie" style="display:none;BORDER-RIGHT: #f3cb6a 1px solid; BORDER-TOP: #f3cb6a 1px solid; BORDER-LEFT: #f3cb6a 1px solid; WIDTH: 620px; BORDER-BOTTOM: #f3cb6a 1px solid; POSITION: relative; HEIGHT: 120px; BACKGROUND-COLOR: #fff4c3">
    <span id="lbHeader" class="Header2" style="width:616px;"><strong>Cookies Disabled.</strong></span><BR>
    <span id="lbMessage" style="height:72px;width:609px;"><p align=left style="MARGIN-LEFT: 10px">
Your browser currently has cookies disabled. We apologize for the inconvenience, but you will need to enable cookies before you can
<a href="https://skyfex.com/client/"><strong>join assistance session</strong></a>.
To help you make the change, below are instructions for enabling cookies:<BR><BR>
<strong>Microsoft Internet Explorer 6.0+</strong><BR>
Select "Internet Options" from the Tools menu.<BR>
Click on the "Privacy" tab.<BR>
Click the "Default" button (or manually slide the bar down to "Medium") under "Settings".<BR>
Click "OK".<BR>
<strong>Microsoft Internet Explorer 5.x</strong><BR>
Select "Internet Options" from the Tools menu.<BR>
Click on the "Security" tab.<BR>
Click the "Custom Level" button.<BR>
Scroll down to the "Cookies" section.<BR>
To enable:<BR>
Set "Allow cookies that are stored on your computer" to "Enable".<BR>
Set "Allow per-session cookies" to "Enable".<BR>
Click "OK".<BR><BR>
<div id="source_body" style="display:none">
<!-- ********** header layout ********** -->
<div id="head_out"><div id="head_in">
      <table width="100%">
      <td align="left">
            <img src="https://skyfex.com/img/skyfex.gif" width="163" height="37" alt="SKYFEX" title="SKYFEX" id="logo">
      <td width="100%">
      <td >
            <div id="SupportVista" style="display:none;">
                  <a href="http://skyfex.com/client/main.html" target="_blank">Support Vista</a>
      <td >
            <a href="http://skyfex.com" target="_blank">SkyFex&nbsp;web&nbsp;site</a>&nbsp;&nbsp;&nbsp;
      <td >
            <a href="http://skyfex.com/help.php" target="_blank">Help</a>&nbsp;&nbsp;&nbsp;
      <td >
      <INPUT type="button" id="mail_button" name="mail_button" value="Submit Log" onClick="b_mail();" style="display:none;">
      <td width="5px" align="right">&nbsp;</td>
      <td >
            <input type="button" class="button" id="exit_button" name="exit_button" value="Exit" onClick="exit();" >
      <td width="5px" align="right">&nbsp;</td>
      <div class="box" id="msg_limit" style="padding-top:5px; padding-bottom:5px; padding-right:5px; display:none;text-align:right;">
            <INPUT type="button" id="file_button" name="file_button" value="Send File" onClick="b_file();" style=" WIDTH: 100px;">
            <td width="5px"></td>
            <INPUT type="button" id="chat_button" name="chat_button" value="Start Chat" onClick="b_chat();" style=" WIDTH: 100px;">
<!-- ********** messages layout ********** -->
<div class="box" id="msg_generic" style="display:none">
   <h2 id="message_title">SkyFex Remote Assistant.</h2>
   <div id="message_text">
      <p>No activity has been detected in the last 5 minutes. You have been disconnected from SkyFex server. To join session again please click</p>
      <a href="https://skyfex.com/client/"><strong>Get Assistance</strong></a>.
<!-- ********** client_id layout ********** -->
<div class="msg_client_id">
    <div id="msg_client_id" style="display:none">
        <div class="client_id">
            <div id="client_id">
362 951
        <big>Client ID:</big>
      <div class="box" >
            <table cellpadding="10" cellspacing="10">
            <tr><td align="center">
            <div id="enterid_status"  style="display:block"></div>
            <div id="debug_status" style="display:block"></div>
<script language="javascript" type="text/javascript">
<div style="display:none">
<!-- <div id="activexclient" >-->
<OBJECT ID="skyClient" CLASSID="CLSID:F84E0B64-1E86-4640-8094-5B38CEB28C1E" height="1" width="1" CODEBASE = "/download/SkyFexClient.cab#Version=1,0,2,106">
<PARAM name="activex_enable" value=0>
<!-- </div>-->
<script language="javascript" type="text/javascript">
<!-- mummy -->
Watch Question

Can you actually make the AJAX call from your client? Looks like you're hitting the AJAX cross-domain security wall. You might have to do all of your "AJAX" in an iframe.
This one is on us!
(Get your first solution completely free - no credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.