netbrfakes Posted August 2, 2016 at 07:18 AM Report #597922 Posted August 2, 2016 at 07:18 AM Boa noite estou com dificuldade para pegar um dado de um site Esse e o HTML <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- saved from url=(0099)https://secure.worldpay.com/wcc/purchase?instId=312748&testMode=0&cartId=1¤cy=GBP&amount=1.00 --> <html lang="pt"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Cache-Control" content="no-cache,no-store"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GMT"> <title>Bem-vindo ao WorldPay</title> <style type="text/css"> body {background-color: #FFFFFF; margin: 0px 0px 0px 0px;} table.header {background-color: #002469; width: 760px; border: 0px;} td.headerlogo1 {background-color: #002469; vertical-align: top; width: 383px; text-align: right;} td.headerlogo2 {background-color: #FFFFFF; vertical-align: top; width: 272px; text-align: center;} table.nav { background-image:url('/images/wp/navbar.gif'); background-repeat: repeat-x; width: 760px; border: 0px; height: 21px;} table.container { background-color: #FFFFFF; width: 488px; border: 0px; margin-right: auto; margin-left: auto;} td.title {background-color: #FFFFFF; width: 100%;} table.containercell {background-color: #FFFFFF; width: 100%; border: 0;} h1 {font-size: 14pt; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; color: #002469; margin: 0px;} h2 {font-size: 12pt; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; color: #FFFFFF; font-weight: bold; margin: 0px;} h3 {font-size: 12pt; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; color: #002469; font-weight: bold; margin: 0px;} A.header:Link {text-decoration: none; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt; font-weight: bold;} A.header:Visited {text-decoration: none; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt; font-weight: bold;} A.header:Active {text-decoration: none; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt; font-weight: bold;} A.header:Hover {text-decoration: underlined; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt; font-weight: bold;} hr {color: #002469; background-color: #002469; height: 3px;} td.footerdivider { background-image: url('/images/wp/dotline.gif');; background-repeat: repeat-x; vertical-align: middle; text-align: center; width:760px; height:1px;} td.footer {background-color: #FFFFFF; vertical-align: middle; text-align: center; width:760px;} @media print { body {font-size:100%; width: 100%; margin: 0; float: none; font-family:Times New Roman, Serif; color: #000000; background: #ffffff;} table.header {display:none; width: 100%;} td.headerlogo1 {display:none;} td.headerlogo2 {display:none;} table.nav {display:none; width: 100%;} table.container {background-color: #ffffff; width: 100%;} td.title {background-color: #ffffff; color: #000000; width: 100%;} table.containercell {background-color: #ffffff; width: 100%;} h1 {font-size:130%; color: #000000;} h2 {font-size:120%; color: #000000;} h3 {font-size:110%; color: #000000;} A.header:Link {display:none;} A.header:Visited {display:none;} A.header:Active {display:none;} A.header:Hover {display:none;} hr {color: #000000; background-color: #000000; height: 1px;} td.footerdivider {display:none; width: 100%;} td.footer {display:none; width: 100%;} td.brand {display:none;} td.two {background-color: #ffffff;} td.one {background-color: #ffffff;} td.error {background-color: #ffffff;} td.three {background-color: #ffffff;} .print_buttons {display:none;} #print_buttons tr{display:none;} div.print_buttons {display:none;} img.print_buttons {display:none;} } </style> <!-- additional HTML head items --> <style type="text/css" media="screen"> td.error {background-color: #FFFFFF; width: 100%;} td.one {background-color: #FFFFFF; } A.one:Link {text-decoration: none; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt;} A.one:Visited {text-decoration: none; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt;} A.one:Active {text-decoration: none; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt;} A.one:Hover {text-decoration: underlined; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt;} td.width190 {width:190px;} td.cardlabel {background-color: #FFFFFF; } td.two {background-color: #EAF1EE; } A.twoinstr:Link {text-decoration: underlined; color: #002469;} A.twoinstr:Visited {text-decoration: underlined; color: #002469;} A.twoinstr:Active {text-decoration: underlined; color: #002469;} A.twoinstr:Hover {text-decoration: underlined; color: #002469;} td.three {background-color: #002469; width:100%;} A.three:Link {text-decoration: none; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt;} A.three:Visited {text-decoration: none; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt;} A.three:Active {text-decoration: none; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt;} A.three:Hover {text-decoration: underlined; color: #002469; font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt;} A.brand:Link {text-decoration: underlined; color: #000000;} A.brand:Visited {text-decoration: underlined; color: #000000;} A.brand:Active {text-decoration: underlined; color: #000000;} A.brand:Hover {text-decoration: underlined; color: #002469;} td.brand {background-color: #FFFFFF; vertical-align: top; text-align: left;} img.printonly {display:none;} .hiddenBankDetails { display: none; } </style> </head> <!-- header.html $Revision$ --> <body> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tbody><tr> <td style="width:100%;" valign="top" align="left"> <table width="760" cellpadding="0" cellspacing="0" border="0"> <tbody><tr> <td valign="top" style="width:760px; height:67px;"> <table class="header" cellspacing="0" cellpadding="0"> <tbody><tr> <td><img src="./Bem-vindo ao WorldPay_files/new_wplogo.gif" style="width:372px; height:67px; border:0px;" alt="WorldPay logo"></td> <td class="headerlogo1"><img src="./Bem-vindo ao WorldPay_files/magic.gif" alt=""></td> </tr> </tbody></table> </td> </tr> <tr> <td style="width:760px;"> <table class="nav" cellspacing="0" cellpadding="0"> <tbody><tr> <td style="width:10px; height:21px;" align="left"><img src="./Bem-vindo ao WorldPay_files/magic.gif" style="width:10px; height:21px; border:0px;" alt=""></td> <td align="left" style="vertical-align:middle;"> <a href="https://secure.worldpay.com/global3/brands/worldpay/payment/default/help_pt.html" class="header" target="_blank" title="Ajuda - Abre numa nova janela">Ajuda</a> <a href="https://secure.worldpay.com/global3/brands/worldpay/payment/default/help_faqs_pt.html" class="header" target="_blank" title="Perguntas mais frequentes - Abre numa nova janela">Perguntas mais frequentes</a> <a href="https://secure.worldpay.com/global3/brands/worldpay/payment/default/help_security_pt.html" class="header" target="_blank" title="Segurança - Abre numa nova janela">Segurança</a></td> </tr> </tbody></table> </td> </tr> <tr> <td colspan="5" style="width:760px;" valign="top" align="left"> <table cellpadding="2" cellspacing="0" border="0"> <tbody><tr> <td class="headerlogo2"><img src="./Bem-vindo ao WorldPay_files/lock.gif" alt=""></td> <td style="width:488px" valign="top" align="left"> <form action="https://secure.worldpay.com/wcc/purchase" method="post" autocomplete="off"> <table class="container" cellpadding="0" cellspacing="0" align="center"> <tbody><tr> <td> <!-- the main content table --> <table class="containercell" cellspacing="0" cellpadding="2"> <tbody><tr> <td class="title" colspan="2"> <!-- page title --> <h1>Página de pagamento seguro</h1> <!-- end page title --> </td> </tr> <!-- end tableHead.html --> <!-- dispPage.templ $Revision$ --> <!--WP start dispatcher/dispPage --> <input type="hidden" name="PaymentID" value="ukdc2-pz-pay08-dppr-1470112782218"> <!--WP start testModeMessage --> <!--WP end testModeMessage --> <!--WP Intro text --> <tr> <td colspan="2" class="one" align="left"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 8pt; color: #002469;">Verifique os detalhes da sua compra, em seguida seleccione um método de pagamento para continuar.</span></td> </tr> <!--WP Intro text --> <!--WP Feedback messages - uses comp.dispatcher.error etc. --> <!--WP end Feedback messages --> <!--WP Details --> <tr> <td colspan="2" class="one"> <table cellpadding="0" cellspacing="0" border="0"> <!--WP language select --> <tbody><tr valign="bottom"> <td valign="top" align="left"> <label for="op-Language"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 12pt; color: #002469;"><b>Seleccionar o idioma</b></span></label> </td> <td valign="bottom" align="left"> <!-- selection.comp $Revision$ --> <select name="Lang"> <option value="da">Dansk </option><option value="de">Deutsch </option><option value="et">Eesti </option><option value="en">English </option><option value="es">Español </option><option value="el">Eλληνικά </option><option value="fr">Français </option><option value="it">Italiano </option><option value="lv">Latviešu </option><option value="hu">Magyar </option><option value="nl">Nederlands </option><option value="no">Norsk </option><option value="pl">Polski </option><option value="pt" selected="selected">Português </option><option value="ru">Pyccкий </option><option value="ro">Română </option><option value="sk">Slovenčina </option><option value="fi">Suomi </option><option value="sv">Svenska </option><option value="tr">Türkçe </option><option value="cs">Čeština </option><option value="bg">Български </option><option value="ja">日本語 </option><option value="ko">한국어 </option></select> <input name="op-Language" id="op-Language" type="image" src="./Bem-vindo ao WorldPay_files/proceed.gif" alt="Seleccionar o idioma"> </td> </tr> <!--WP language select --> <!-- BIBIT country select --> <!--WP currency drop down --> <input type="hidden" name="authCurrency" value="GBP"> <!--WP end currency drop down --> <!--WP Description --> <tr><td colspan="2" class="one"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt; color: #002469;"><b>GO FISH UTILITIES LTD</b></span></td></tr> <!--WP END Description --> <!--WP FuturePay --> <tr> <td class="one width190" align="left" valign="top"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt; color: #002469;">Montante</span> </td> <td class="one width190" align="left" valign="top"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 10pt; color: #002469;"><b>£1.00</b></span></td> </tr> <!--WP RFP attributes--> <!--WP RFP END--> <!--WP LFP attributes--> <!--WP END LFP --> <!--WP END FP --> </tbody></table> </td> </tr> <!--WP END Details --> <!-- start Bibit Order Contents --> <!-- end Bibit Order Contents --> <!--WP spacer row --> <tr> <td colspan="2" class="one" height="5"><img src="./Bem-vindo ao WorldPay_files/magic.gif" style="width:1px; height:5px;" alt=""></td> </tr> <!--WP end spacer row --> <!--WP clickable card logos --> <tr valign="middle"> <td colspan="2" class="one" align="left"> <div class="print_buttons"> </div><table width="100%" cellpadding="0" cellspacing="0" border="0"> <tbody><tr> <td class="three" align="left" valign="middle"><h2> Seleccione o método de pagamento</h2></td> <td class="one" align="right"><a href="https://secure.worldpay.com/global3/payment/default/help_dispatcher_pt.html" target="_blank" title="Escolher um método de pagamento. Abrir numa nova janela - Abre numa nova janela"><img src="./Bem-vindo ao WorldPay_files/help.gif" alt="Escolher um método de pagamento. Abrir numa nova janela" style="border:0px;" class="print_buttons"></a></td> </tr> <tr> <td class="two" align="left"> </td></tr><tr> <td class="cardlabel" align="left"> <table cellpadding="2" cellspacing="3" border="0"> <tbody><tr> <td align="center" valign="top"><input name="op-DPChoose-ECMC^SSL" type="image" src="./Bem-vindo ao WorldPay_files/ECMC.gif" alt="MasterCard"><br><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 8pt; color: #000000;">MasterCard</span></td> <td align="center" valign="top"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 8pt; color: #000000;"><input name="op-DPChoose-VISA^SSL" type="image" src="./Bem-vindo ao WorldPay_files/VISA.gif" alt="Visa"><br>Visa</span></td> <td align="center" valign="top"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 8pt; color: #000000;"><input name="op-DPChoose-MAESTRO^SSL" type="image" src="./Bem-vindo ao WorldPay_files/MAESTRO.gif" alt="Maestro"><br>Maestro</span></td> <td align="center" valign="top"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 8pt; color: #000000;"><input name="op-DPChoose-JCB^SSL" type="image" src="./Bem-vindo ao WorldPay_files/JCB.gif" alt="JCB"><br>JCB</span></td> <td align="center" valign="top"></td> <td align="center" valign="top"></td> </tr> </tbody></table> </td> </tr> <tr><td class="one" align="center"> </td> </tr> <!--WP cancel button --> <tr> <td class="three" align="right"><label for="op-DPCancel"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 12pt; color: #FFFFFF;"><b>Cancelar</b></span></label> </td> <td class="one" align="left"><input name="op-DPCancel" id="op-DPCancel" type="image" src="./Bem-vindo ao WorldPay_files/cancel.gif" alt="Cancelar"></td> </tr> <!--WP end cancel button --> </tbody></table> </td> </tr> <!--WP end clickable card logos --> <!-- WP brand logo --> <!-- start brand.comp --> <tr> <td colspan="2" class="brand"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tbody><tr> <td class="brand" width="150"> <a href="http://www.worldpay.com/" target="_blank" title="Abre numa nova janela"><img src="./Bem-vindo ao WorldPay_files/brand.gif" alt="Powered by WorldPay" border="0"></a> </td> <td class="brand"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 8pt; color: #000000;">Para obter ajuda com o seu pagamento, visite a: <a href="https://secure.worldpay.com/global3/brands/worldpay/payment/fixed/help_brand_pt.html" target="_blank" title="Abre numa nova janela" class="brand">Ajuda do WorldPay</a>.</span></td> </tr> </tbody></table> </td> </tr> <!-- end brand.comp --> <!-- WP brand logo --> <script type="text/javascript"> var selectBox=document.getElementsByName("authCurrency")[0]; if(selectBox){ selectBox.onchange = function(){ document.getElementById("op-Currency").click(); }; } </script> <!--WP end dispatcher/dispPage --> </tbody></table> </td> </tr> </tbody></table> </form> </td> </tr> <tr> <td colspan="5" valign="top" align="left" style="height:5px;"><img src="./Bem-vindo ao WorldPay_files/magic.gif" style="height:5px; border:0px;" alt=""></td> </tr> </tbody></table> </td> </tr> <tr> <td colspan="5" class="footerdivider"><img src="./Bem-vindo ao WorldPay_files/magic.gif" style="width:1px; height:1px; border:0px;" alt=""></td> </tr> <tr> <td colspan="5" class="footer"><span style=" font-family: Verdana,Geneva,Arial,Helvetica,Sans-Serif; font-size: 8pt; color: #000000;">WorldPay (UK) Limited © 2012</span></td> </tr> </tbody></table> </td> </tr> </tbody></table> </body></html> o que preciso pegar é o que esta dentro de <input type="hidden" name="PaymentID" value="ukdc2-pz-pay08-dppr-1470112782218"> O código que estou usando é <?php function gerachave() { $ssite=('https://secure.worldpay.com/wcc/purchase?instId=312748&testMode=0&cartId=1¤cy=GBP&amount=1.00'); $q=@file_get_contents($ssite); print preg_match_all('#<input type="hidden" name="PaymentID" value="(.*)" />#i',$q,$match); $otitle=($match[0][0]); return ($match[0][0]); } echo(gerachave()); ?> Porém ainda não obtive sucesso, se alguém puder me ajudar obrigado!
HappyHippyHippo Posted August 3, 2016 at 08:40 AM Report #597960 Posted August 3, 2016 at 08:40 AM passa o conteúdo do site para um objecto DomDocumento onde podes fazer a pesquisa que pretendes (até mesmo usando o simplexml) IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
tiago.f Posted August 3, 2016 at 03:01 PM Report #597974 Posted August 3, 2016 at 03:01 PM Oi, pelo que vejo não há nenhuma barra a fechar o "input": '/>', no entanto a tua expressão regular está à procura duma... EDIT: podes testar aqui https://pt.functions-online.com/preg_match.html
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now