deserty Posted June 26, 2012 Report Share Posted June 26, 2012 Am urmatorul cod :<?phpfunction ia_continutul($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } $pagina = "https://rstcenter.com";$continut= ia_continutul($pagina); echo $continut;?>Cum pot pune intr-o variabila doar o bucata cod din ceea ce imi returneaza $continut ?exemplu : $var="[RST]"; Quote Link to comment Share on other sites More sharing options...
Irk Posted June 26, 2012 Report Share Posted June 26, 2012 (edited) strpos, substr, preg_match, preg_match_all, etc.regexpal.comIti recomand insa Guzzle ca si crawler (pentru ca suporta caching si requesturi paralele) si componenta symfony CssSelector pentru parsare de DOM. Poti sa le combini usor cu composer. Edited June 26, 2012 by Irk Quote Link to comment Share on other sites More sharing options...
deserty Posted June 26, 2012 Author Report Share Posted June 26, 2012 Merci. Am sa le studiez, insa mai simplu nu se poate ? Vreau sa extrag doar o bucata de cod din ceea ce imi returneaza.Am cautat niste parametrii pentru curl_exec, insa nu am gasit. Quote Link to comment Share on other sites More sharing options...
Irk Posted June 26, 2012 Report Share Posted June 26, 2012 foloseste atunci functiile php pentru procesare de stringuri pe care le-am amintit mai sus Quote Link to comment Share on other sites More sharing options...
deserty Posted June 26, 2012 Author Report Share Posted June 26, 2012 Ok. Am reusit. Mc. Quote Link to comment Share on other sites More sharing options...
shark0der Posted June 26, 2012 Report Share Posted June 26, 2012 (edited) Ca si alternativa misto mai e si phpQuery.Ai grija sa faci $pq->unloadDocument() daca faci scripturi cu multe request-uri, ca de altfel papa multa memorie (unset nu ajuta) Edited June 26, 2012 by shark0der Quote Link to comment Share on other sites More sharing options...
andrew-46 Posted June 26, 2012 Report Share Posted June 26, 2012 Foloseste functia preg_match! Quote Link to comment Share on other sites More sharing options...