Tema: Curl con php
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/12/2013, 01:24
fedemarkco
 
Fecha de Ingreso: junio-2011
Mensajes: 36
Antigüedad: 12 años, 11 meses
Puntos: 1
Curl con php

Hola gente!

Estoy utilizando Curl para obtener el valor de "adcopy_challenge" que te devuelve la url "http://api.solvemedia.com/papi/challenge.script?k=MIqUIMADf7KbDRf0ANI-9wLP.8iJSG9N" pero no lo consigo.

Tengo los siguientes archivos:

api.php
---------------------------------------------------------------------------------

<script type="text/javascript" src="http://api.solvemedia.com/papi/challenge.script?k=MIqUIMADf7KbDRf0ANI-9wLP.8iJSG9N">
</script>

---------------------------------------------------------------------------------



carga.php
---------------------------------------------------------------------------------

<?php

$url ="http://localhost/api.php";

$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_AUTOREFERER, 0);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_URL, $url);
$data = curl_exec ($curl);

echo $data;

print_r (explode("adcopy_challenge", $data));


?>

---------------------------------------------------------------------------------


Cuando ejecuto el archivo carga.php obtengo como resultado del explode:

---------------------------------------------------------------------------------

Array ( [0] => )

---------------------------------------------------------------------------------


Como que no lo encuentra.
Y si me fijo en "inspeccionar elemento" de Google Chrome me aparece:

---------------------------------------------------------------------------------

<html><head><script async="" src="http://b.scorecardresearch.com/beacon.js"></script><script type="text/javascript" src="http://api.solvemedia.com/papi/challenge.script?k=MIqUIMADf7KbDRf0ANI-9wLP.8iJSG9N">
</script><script type="text/javascript" src="//api.solvemedia.com/papi/_puzzle.js"></script><style type="text/css"> #adcopy-outer{background-color:#f8f8f8;color:#000;border:1px solid #bbb;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;width:300px;padding:3px;margin:0px;} #adcopy-outer tbody,#adcopy-outer table,#adcopy-outer span,#adcopy-outer tr,#adcopy-outer td,#adcopy-outer a,#adcopy-outer img{padding:0 !important;margin:0 !important;border:0 !important;line-height:normal !important;} #adcopy-outer td{white-space:nowrap !important;} #adcopy-instr,#adcopy-error-msg{font-size:10pt;font-family:sans-serif;} #adcopy-instr{color:#000;display:inline;} #adcopy-error-msg{color:#f00;display:none;} #adcopy-outer #adcopy-logo A:hover{background-color:transparent;} #adcopy-outer #adcopy-logo{color:#000;display:inline;} #adcopy-outer A{color:#004;text-decoration:none;} #adcopy-link-image,#adcopy-pixel-image,#adcopy_challenge_container{display:none;} #adcopy-outer #adcopy-link-logo img{vertical-align:middle;} #adcopy-link-refresh,#adcopy-link-info{display:inline;} #adcopy-outer #adcopy-link-refresh img,#adcopy-outer #adcopy-link-info img,#adcopy-outer #adcopy-link-audio img,#adcopy-outer #adcopy-link-image img{vertical-align:middle;} #adcopy-puzzle-image{height:150px;width:300px;} #adcopy-puzzle-image img{float:none !important;} #adcopy-outer #adcopy_response{width:185px !important;margin:2px 0 0 0;font-size:12px;} #adcopy-response-cell{height:23px;} @-webkit-keyframes adcopy-bouncer{0%,6%,12%,18%,24%,100%{-webkit-transform:translate(0,0);} 3%{-webkit-transform:translate(1px,-10px);} 9%{-webkit-transform:translate(0px,8px);} 15%{-webkit-transform:translate(0px,-5px);} 21%{-webkit-transform:translate(1px,2px);} } @-moz-keyframes adcopy-bouncer{0%,6%,12%,18%,24%,100%{-moz-transform:translate(0,0);} 3%{-moz-transform:translate(1px,-10px);} 9%{-moz-transform:translate(0px,8px);} 15%{-moz-transform:translate(0px,-5px);} 21%{-moz-transform:translate(1px,2px);} } .adcopy-info-bouncy img{-webkit-animation:adcopy-bouncer 2s infinite;-moz-animation:adcopy-bouncer 2s infinite;} .adcopy-info-bouncy img:hover{-webkit-animation:none;-moz-animation:none;} </style> <script type="text/javascript" src="//api.solvemedia.com/papi/_challenge.js?k=MIqUIMADf7KbDRf0ANI-9wLP.8iJSG9N;f=_ACPuzzleUtil.callbacks%5B0%5D;l=en ;t=img;s=standard;c=js,h5c,h5ct,svg,h5v,v/h264,v/ogg,v/webm,h5a,a/mp3,a/ogg,ua/chrome,ua/chrome31,os/nt,os/nt6.2,swf11,swf11.9,swf,fwv/NulK0g.jxxk35;am=w07QU-KaHZ71p5tr4podng;ca=script;ts=1385967287;ct=138596 7453;th=white;r=0.8756890976801515"></script></head><body><div id="adcopy-outer"> <table cellpadding="0" cellspacing="0"> <tbody><tr><td colspan="3"><div id="adcopy-puzzle-image"><img src="//api.solvemedia.com/papi/[email protected]@Vql8wtAoiR4ENU8bgrS3.X9APTC4lJjoX69.h NzcGY5jhZemRXCWVqudppsnwo4q-KTQr6IcP4-HqtHhQljShQ.g5JbxVPC.LWo5uU3ZxQUHPZmuSoQDS9Lqm.WTe ySrW6jpznfjzb2fcItjViazdxl4ixain6M-HFOM2x3mPsjAHxyIrEHfVBqgeBrxlODgoddct.NLM9E0P79OwV Amk-vbXNztAtka9jwNWHtLANyiMoHE5oOJ8RLCmrV0igplJcVSNb2d lVTu2vzTGWOblZN49fQe60kGJkhFXIK0uoA;w=300;h=150;fg =000000;bg=f8f8f8" alt="Solve Media Puzzle Challenge" height="150" width="300" id="adcopy-puzzle-image-image"></div> </td></tr> <tr id="adcopy-instr-row"><td><span id="adcopy-instr" style="display: inline;">Your Answer</span><span id="adcopy-error-msg" style="display: none;"></span></td> <td><div id="adcopy-pixel-image" style="display:none;"><br><img src="http://map.media6degrees.com/orbserv/hbpix?pixId=16483&amp;pcv=60" alt="" height="1" width="1"><img src="http://adadvisor.net/adscores/r.pixel?sid=9212136498" alt="" height="1" width="1">
<script>
window._comscore = window._comscore || [];

_comscore.push({ c1: "8", c2: "14651931", c3: "1000000000000000001" });

(function() {
var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js";
el.parentNode.insertBefore(s, el);
})();
</script>

<iframe width="0" height="0" frameborder="0" src="http://loadus.exelator.com/load/?p=490&amp;g=003&amp;c=&amp;kw=&amp;refkw=&amp;j=w "></iframe>
</div></td> <td align="center"><span id="adcopy-logo"><a href="javascript:ACPuzzle.moreinfo('')" id="adcopy-link-logo" title=""><img src="//api.solvemedia.com/media/solve-whV2.png" alt="Solve Media"></a></span></td> </tr> <tr> <td id="adcopy-response-cell"><input type="text" name="adcopy_response" autocomplete="off" autocorrect="off" size="20" id="adcopy_response"><span id="adcopy_challenge_container"><input type="hidden" name="adcopy_challenge" id="adcopy_challenge" value="[email protected]@Vql8wtAoiR4ENU8bgrS3.X9APTC4lJjoX69.h NzcGY5jhZemRXCWVqudppsnwo4q-KTQr6IcP4-HqtHhQljShQ.g5JbxVPC.LWo5uU3ZxQUHPZmuSoQDS9Lqm.WTe ySrW6jpznfjzb2fcItjViazdxl4ixain6M-HFOM2x3mPsjAHxyIrEHfVBqgeBrxlODgoddct.NLM9E0P79OwV Amk-vbXNztAtka9jwNWHtLANyiMoHE5oOJ8RLCmrV0igplJcVSNb2d lVTu2vzTGWOblZN49fQe60kGJkhFXIK0uoA"></span></td> <td></td> <td align="center"><a href="javascript:ACPuzzle.reload('')" id="adcopy-link-refresh" title="New Puzzle"><img src="//api.solvemedia.com/media/reload-whV2.gif" alt="New Puzzle"></a><a href="javascript:ACPuzzle.change2audio('')" id="adcopy-link-audio" title="Switch to audio puzzle" style="display: inline;"><img src="//api.solvemedia.com/media/note-whV2.gif" alt="Switch to audio puzzle"></a><a href="javascript:ACPuzzle.change2image('')" id="adcopy-link-image" title="Switch to visual puzzle" style="display: none;"><img src="//api.solvemedia.com/media/text-whV2.gif" alt="Switch to visual puzzle"></a><a href="javascript:ACPuzzle.moreinfo('')" id="adcopy-link-info" title="More Information..." class=""><img src="//api.solvemedia.com/media/info-whV2.gif" alt="More Information..."></a></td> </tr> </tbody></table> </div>

</body></html>

---------------------------------------------------------------------------------


Lo que está puesto en negrita y rojo es la ubicación de adcopy_challenge y su respectivo valor que es lo que quiero obtener.

Se les ocurre alguna idea para obtener ese dato?