cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

javascript on remote page

From: ascii <ascii00_at_online.no>
Date: Fri, 28 Oct 2005 12:23:26 +0200

This is my PHP :

       $url =
"https://metro.telenor.no/metro2-application-kapaks-web/kapaksweb";

       $ch = curl_init();
       $cookie_file_path = "cookies";
       $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4)
Gecko/20030624 Netscape/7.1 (ax)\
";

       curl_setopt($ch, CURLOPT_URL, $url);
       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
       curl_setopt($ch, CURLOPT_SSL_VERIFYHOST , 0);
       curl_setopt($ch, CURLOPT_POST, 1);
       curl_setopt ($ch, CURLOPT_POSTFIELDS,
"nummer=38324089&produktTlf=ADSL-BASIS");
       curl_setopt($ch, CURLOPT_USERPWD, "hidden:hidden");
       curl_setopt($ch, CURLOPT_USERAGENT, $agent);
       curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
       curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
       curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

       $store = curl_exec ($ch);
       echo curl_error($ch);
       curl_close ($ch);

       echo $store;
And the source on kapaks is :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
<TITLE>KapaksWeb</TITLE>
<LINK REL="STYLESHEET" HREF="kapaks.css" TYPE="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="kapaks.js">
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
function showSearch() {
// if (("" == "" && "" != "") || ("null" != "null") || ("null" !=
"null") ) if ("" == "" ) {
   hidelayer("relocationCheck");
   hidelayer("addressSearch");
   // doFocus(document.forms[0].kommune);
   showlayer("phoneSearch");
   doFocus(document.forms[0].nummer);
 } else {
    if (searchLayer != "") {
          if ("" != "phoneSearch")
            hidelayer("phoneSearch");
          if ("" != "relocationCheck")
            hidelayer("relocationCheck");
          if ("" != "addressSearch")
            hidelayer("addressSearch");
        showlayer("");
    }
   //doFocus(document.forms[0].nummer);
 } }
function doNothing() {
}
function entsub(event,ourform) {
 if (window.event && window.event.keyCode == 13)
   if (verifiserInput()) ourform.submit();
 else if (window.event)
   return true;
 else if (event && event.which == 13)
   if (verifiserInput()) ourform.submit();
 else
   return true;
}
</SCRIPT>
</HEAD>
<body onLoad="showSearch()">

<FORM METHOD="POST" action="kapaksweb"
    onSubmit="return verifiserInput()" onReset="return nullstillForm()">
<table width="100%" cellspacing="10" cellpadding="2" border="0">
    <tr>
        <td colspan="2">
        <table border="0" cellpadding="0" cellspacing="2" width="100%">
            <tr>
                <td rowspan="2" class="heading">
                    <img src="images/kapaks_head_enkeltsok.gif"
border="0" align="left"
                    alt="KapaksInfo">
                </td>
            </tr>

        </table>
        </td>
    </tr> <tr>
        <td valign="top" nowrap width="320">

<TABLE cellpadding="0" cellspacing="0" border="0" width="270">
<tr>
<td>
<div class="search1" id="phoneSearch">
<TABLE cellpadding="0" cellspacing="0" border="0">
<tr>

<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="8" align="right" valign="top" class="corner"><img
src="images/frontpage_r3_vensterhjorne_off.jpg" width="8" height="34"
border="0" alt=""></td>
<td width="100%" class="searchheader">&nbsp;</td>
<td width="7" align="left" valign="top" class="corner"><img
src="images/frontpage_r3_hoyrehjorne_off2.jpg" width="7" height="34"
border="0" alt=""></td>
</tr>
</table>
</td>
</tr>
<TR>
<TD align="left" valign="top" class="searchdata">
<table cellpadding="0" cellspacing="0" border="0" class="search">
<tr>
<td class="leadText">Tlf.nr.:&nbsp;&nbsp; </td>

<td><INPUT TYPE="TEXT" NAME="nummer" SIZE="20" value=""></td>
</tr>
<tr>

<td colspan="2" class="leadText">Gjelder sambandsnr.&nbsp;<INPUT
TYPE="checkbox" NAME="samband" value="samband" ></td>
</tr>
</table>

</TD>
</TR>
<TR align="left" valign="top">
<TD class="searchdata">
<TABLE width="100%" border="0" cellspacing="0" cellpadding="2"
class="search">
<tr>
<td colspan="4" class="leadText"><b>Mulige produkter å søke på:</b></td>

</tr>
<TR><TD colspan='2' class='product'>ADSL Basis</TD><TD><INPUT
type='RADIO' name=produktTlf value='ADSL-BASIS' checked
onkeypress='return entsub(event,this.form)'></TD></TR><TR><TD
colspan='2' class='product'>ADSL Premium</TD><TD><INPUT type='RADIO'
name=produktTlf value='ADSL-PREMIUM' onkeypress='return
entsub(event,this.form)'></TD></TR><TR><TD colspan='2'
class='product'>ISDN</TD><TD><INPUT type='RADIO' name=produktTlf
value='ISDN' onkeypress='return
entsub(event,this.form)'></TD></TR><TR><TD colspan='2'
class='product'>Digital Ethernet</TD><TD><INPUT type='RADIO'
name=produktTlf value='DIGITAL-ETHERNET' onkeypress='return
entsub(event,this.form)'></TD></TR><TR><TD colspan='2'
class='product'>SHDSL</TD><TD><INPUT type='RADIO' name=produktTlf
value='SHDSL' onkeypress='return
entsub(event,this.form)'></TD></TR><TR><TD colspan='2'
class='product'>OperatørAksess</TD><TD><INPUT type='RADIO'
name=produktTlf value='OA' onkeypress='return
entsub(event,this.form)'></TD></TR>
<TR>
<TD VALIGN="top" COLSPAN="2" align="left" class="submit">
<INPUT TYPE="SUBMIT" NAME="button" VALUE="Utfør søk"></TD>
</TR>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td colspan="4"><a href="javascript: doNothing()" class="link"
onClick="showlayer('addressSearch'); hidelayer('phoneSearch'); return
false;">Til adressesøk</a></td>

</tr>
<tr>
<td colspan="4"><a href="javascript: doNothing()" class="link"
onClick="showlayer('relocationCheck'); hidelayer('phoneSearch'); return
false;">Til medflytt sjekk</a></td>
</tr>
<TR>
<TD COLSPAN="4">
<A HREF="VolumSearchApplet.html" class="link" >Til Volumsøk</A>
</TD>
</TR>
<TR>
<TD COLSPAN="4">
<A target="hjelpeside" HREF="kapakshjelp.html" class="link" >Hjelp</A>
</TD>
<!--<TD colspan="4">
    <FORM METHOD=POST ACTION="ibm_security_logout" NAME="logout">
        <p>
        <BR>
        <BR>
        <font size="2"><strong> Click this button to log out:
</strong></font>
        <input type="submit" name="logout" value="Logout">
        <INPUT TYPE="HIDDEN" name="logoutExitPage" VALUE="index.html">
        </p>
    </form>
</TD>-->

</TR>
</TABLE>
</TD>
</TR>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right" width="8" class="corner"><img
src="images/frontpage_bottom_left_corner.jpg" height="45" width="8"
border="0" alt=""></td>
<td width="100%" class="searchfooter"><FONT SIZE='-2'>Bruker:
rbm35wn<br>Versjon: 4.3.0.3</FONT></td>
<td align="right" width="65" class="corner"><img
src="images/frontpage_bottom_right_corner2.jpg" height="45" width="65"
border="0" alt=""></td>
</tr>
</table>
</td>
</tr>

</TABLE>
</div>

<div class="search2" id="addressSearch">
<TABLE cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="8" align="right" valign="top" class="corner"><img
src="images/frontpage_r3_vensterhjorne_off.jpg" width="8" height="34"
border="0" alt=""></td>
<td width="100%" class="searchheader">&nbsp;</td>
<td width="7" align="left" valign="top" class="corner"><img
src="images/frontpage_r3_hoyrehjorne_off2.jpg" width="7" height="34"
border="0" alt=""></td>
</tr>
</table>

</TD>

</TR>
<TR align="left" valign="top">
<TD class="searchdata">
<table cellpadding="0" cellspacing="0" border="0" class="search">
<tr>
<td class="leadText">FAR ID:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="farid" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Kommune<br><font size="-1">(navn el
nr)</font>:&nbsp;&nbsp; </td>

<td><INPUT TYPE="TEXT" NAME="kommune" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Gårdsnummer:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="gardsnr" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Bruksnummer:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="bruksnr" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Vei <font size="-1">(navn el
nr)</font>:&nbsp;&nbsp; </td>

   <td><INPUT TYPE="TEXT" NAME="vei" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>

</tr>
<tr>
<td class="leadText">Husnummer:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="hus" SIZE="20" value="" onkeypress="return
entsub(event,this.form)"><td>
</tr>
<tr>
<td class="leadText">Husbokstav/oppg.:&nbsp;</td>
<td><INPUT TYPE="TEXT" NAME="bokstav" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>

<td class="leadText">Etasje:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="etasje" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Leilighet:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="leil" SIZE="20" value="" onkeypress="return
entsub(event,this.form)"></td>
</tr>
</table>
</TD>

</TR>
<TR align="left" valign="top">
<TD class="searchdata">

<TABLE width="100%" border="0" cellspacing="0" cellpadding="2"
class="search">
<tr>
<td colspan="4" class="leadText"><b>Mulige produkter å søke på:</b></td>
</tr>
<TR><TD colspan='2' class='product'>ADSL Basis</TD><TD><INPUT
type='RADIO' name=produktAdr value='ADSL-BASIS' checked
onkeypress='return entsub(event,this.form)'></TD></TR><TR><TD
colspan='2' class='product'>ADSL Premium</TD><TD><INPUT type='RADIO'
name=produktAdr value='ADSL-PREMIUM' onkeypress='return
entsub(event,this.form)'></TD></TR><TR><TD colspan='2'
class='product'>ISDN</TD><TD><INPUT type='RADIO' name=produktAdr
value='ISDN' onkeypress='return
entsub(event,this.form)'></TD></TR><TR><TD colspan='2'
class='product'>Digital Ethernet</TD><TD><INPUT type='RADIO'
name=produktAdr value='DIGITAL-ETHERNET' onkeypress='return
entsub(event,this.form)'></TD></TR><TR><TD colspan='2'
class='product'>SHDSL</TD><TD><INPUT type='RADIO' name=produktAdr
value='SHDSL' onkeypress='return
entsub(event,this.form)'></TD></TR><TR><TD colspan='2'
class='product'>OperatørAksess</TD><TD><INPUT type='RADIO'
name=produktAdr value='OA' onkeypress='return
entsub(event,this.form)'></TD></TR>
<TR>
<TD VALIGN="top" COLSPAN="1" align="left" class="reset">
<INPUT TYPE="RESET" NAME="button2" VALUE="Slett felter"></TD>
<TD VALIGN="top" COLSPAN="3" align="left" class="submit">
<INPUT TYPE="SUBMIT" NAME="button" VALUE="Utfør søk"></TD>

</TR>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td colspan="4"><a href="javascript: doNothing()" class="link"
onClick="hidelayer('addressSearch'); showlayer('phoneSearch'); return
false;">Til nummersøk</a></td>
</tr>
<tr>
<td colspan="4"><a href="javascript: doNothing()" class="link"
onClick="hidelayer('addressSearch'); showlayer('relocationCheck');
return false;">Til medflytt sjekk</a></td>
</tr>
<TR>
<TD COLSPAN="4">
<A HREF="VolumSearchApplet.html" class="link" >Til Volumsøk</A>
</TD>

</TR>
<TR>
<TD COLSPAN="4">
<A target="hjelpeside" HREF="kapakshjelp.html" class="link" >Hjelp</A>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right" width="8" class="corner"><img
src="images/frontpage_bottom_left_corner.jpg" height="45" width="8"
border="0" alt=""></td>
<td width="100%" class="searchfooter"><FONT SIZE='-2'>Bruker:
rbm35wn<br>Versjon: 4.3.0.3</FONT></td>

<td align="right" width="65" class="corner"><img
src="images/frontpage_bottom_right_corner2.jpg" height="45" width="65"
border="0" alt=""></td>
</tr>
</table>
</td>
</tr>
</TABLE>
</div>

<div class="search3" id="relocationCheck">
<TABLE cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="8" align="right" valign="top" class="corner"><img
src="images/frontpage_r3_vensterhjorne_off.jpg" width="8" height="34"
border="0" alt=""></td>

<td width="100%" class="searchheader">&nbsp;</td>
<td width="7" align="left" valign="top" class="corner"><img
src="images/frontpage_r3_hoyrehjorne_off2.jpg" width="7" height="34"
border="0" alt=""></td>
</tr>
</table>

</TD>

</TR>
<TR align="left" valign="top">
<TD class="searchdata">
<table cellpadding="0" cellspacing="0" border="0" class="search">
<tr>
<td colspan="2" class="leadText"><b>Telefonnummer man &oslash;nsker
&aring; medflytte</b></td>

</tr>
<tr>
<td class="leadText">Tlf.nr.:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="relnummer" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td colspan="2" class="leadText"><b>Adresse man &oslash;nsker &aring;
flytte nummeret til</b></td>
</tr>
<tr>
<td class="leadText">FAR ID:&nbsp;&nbsp; </td>

<td><INPUT TYPE="TEXT" NAME="relfarid" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Kommune<br><font size="-1">(navn el
nr)</font>:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="relkommune" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Gårdsnummer:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="relgardsnr" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>

<td class="leadText">Bruksnummer:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="relbruksnr" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Vei <font size="-1">(navn el
nr)</font>:&nbsp;&nbsp; </td>

<td><INPUT TYPE="TEXT" NAME="relvei" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Husnummer:&nbsp;&nbsp; </td>

<td><INPUT TYPE="TEXT" NAME="relhus" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"><td>
</tr>
<tr>
<td class="leadText">Husbokstav/oppg.:&nbsp;</td>
<td><INPUT TYPE="TEXT" NAME="relbokstav" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Etasje:&nbsp;&nbsp; </td>
<td><INPUT TYPE="TEXT" NAME="reletasje" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
<tr>
<td class="leadText">Leilighet:&nbsp;&nbsp; </td>

<td><INPUT TYPE="TEXT" NAME="relleil" SIZE="20" value=""
onkeypress="return entsub(event,this.form)"></td>
</tr>
</table>
</TD>

</TR>
<TR align="left" valign="top">
<TD class="searchdata">
<TABLE width="100%" border="0" cellspacing="0" cellpadding="2"
class="search">
<TR>
<TD VALIGN="top" COLSPAN="2" align="left" class="reset">
  <INPUT TYPE="RESET" NAME="button2" VALUE="Slett felter"></TD>
<TD VALIGN="top" COLSPAN="2" align="left" class="submit">
<INPUT TYPE="SUBMIT" NAME="button" VALUE="Sjekk medflytting"></TD>
</TR>
<tr>

<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td colspan="4"><a href="javascript: doNothing()" class="link"
onClick="hidelayer('relocationCheck'); showlayer('phoneSearch'); return
false;">Til nummersøk</a></td>
</tr>
<tr>
<td colspan="4"><a href="javascript: doNothing()" class="link"
onClick="hidelayer('relocationCheck'); showlayer('addressSearch');
return false;">Til adressesøk</a></td>
</tr>
<TR>
<TD COLSPAN="4">
<A HREF="VolumSearchApplet.html" class="link" >Til Volumsøk</A>
</TD>
</TR>
<TR>

<TD COLSPAN="4">
<A target="hjelpeside" HREF="kapakshjelp.html" class="link" >Hjelp</A>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right" width="8" class="corner"><img
src="images/frontpage_bottom_left_corner.jpg" height="45" width="8"
border="0" alt=""></td>
<td width="100%" class="searchfooter"><FONT SIZE='-2'>Bruker:
rbm35wn<br>Versjon: 4.3.0.3</FONT></td>
<td align="right" width="65" class="corner"><img
src="images/frontpage_bottom_right_corner2.jpg" height="45" width="65"
border="0" alt=""></td>

</tr>
</table>
</td>
</tr>
</TABLE>
</div>
<INPUT TYPE="hidden" name="currentLayer" value="">
</td>
</tr>
</TABLE>
</td>
        <td valign="top" align="left" class="results" width="1000">
        <div class="waiting" id="pleaseWait">
        <h2>Vennligst vent...</h2>

        </div>
        <div id="results">
</div>
        </td>
    </tr></table>
<p>&nbsp;</p>
</FORM>
</body>
</html>

I can't seem to find any way to bypass the javascripts. The form i want
to submit us the one with nummer=aNumber&produktTlf=ADSL-BASIS
Anyone got any ideas?

thanks, Kristian
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-10-28