Ciao a tutti
Qualcuno che conosce bene CURL mi potrebbe gentilmente aiutare
Inviando un link tramite curl e guardando tutte le richieste e risposte http, esce questo...
Non riesco ad acchiappare la risposta del redirect, perché devo prendere questo:
Location: http://10minutemail.com/10MinuteMail...l?cid=51676268
GET /10MinuteMail/index.html?dataModelSelection=message%3Aemails%5B0 %5D&actionMethod=index.xhtml%3AmailQueue.select HTTP/1.1Codice PHP:
$url = "http://10minutemail.com/10MinuteMail/";
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie9.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie9.txt");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
$output = curl_exec($ch);
curl_close($ch);
preg_match_all("/<br \/>a(.*?) /",$output,$matches);
echo $output; echo "a".$matches[1][0];
preg_match_all("/<td><a href=\"\/10MinuteMail\/index(.*?)\"/",$output,$matches);
echo "
";echo "
";echo "
";
$url = "http://10minutemail.com/10MinuteMail/index";
$url = $url.$matches[1][0];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie9.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie9.txt");
curl_setopt($ch, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch,CURLOPT_HTTPHEADER,array( 'User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:2.0.1) Gecko/20100101 Firefox/4.0.1', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*//**;q=0.8', 'Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3', 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Referer: [url]http://10minutemail.com/10MinuteMail/[/url]', 'Keep-Alive: 115', 'DNT: 1', 'Connection: keep-alive', ));
$output = curl_exec($ch);
echo $output;
Host: 10minutemail.com
User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
DNT: 1
Connection: keep-alive
Referer: http://10minutemail.com/10MinuteMail/
Cookie: JSESSIONID=C4E948E4DAF52496A650534E957AF180; __utma=81663767.1888350020.1318356557.1318371460.1 318374113.3; __utmc=81663767; __utmz=81663767.1318356557.1.1.utmcsr=(direct)|utm ccn=(direct)|utmcmd=(none); org.jboss.seam.core.Locale=it; __utmb=81663767.2.10.1318374113
__________________________________________________ ____________________________
HTTP/1.1 302 Moved Temporarily
Date: Tue, 11 Oct 2011 23:07:52 GMT
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0, JSF/1.2
Location: http://10minutemail.com/10MinuteMail...l?cid=51676268
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=10, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
__________________________________________________ _____________________________
HTTP/1.1 302 Moved Temporarily
Date: Tue, 11 Oct 2011 23:07:52 GMT
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0, JSF/1.2
Location: http://10minutemail.com/10MinuteMail...l?cid=51676268
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=10, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8