snoVop Posted January 15, 2016 Share Posted January 15, 2016 Hello, I work on this code but I block ... I should recover the url: http://full-stream.org/12080-les-huit-salopards.html and display these links (youwatch etc ...) Or is the counsel in my code? <?php require_once "support/http.php"; require_once "support/web_browser.php"; require_once "support/simple_html_dom.php"; $html = new simple_html_dom(); $titleok = "les-huit-salopards" $urlok = 'http://full-stream.org/{id}-{titleok}.html'; for($i=1; $i<=$nbArticle; $i++; $titleok) { $urlAScroller = str_replace('{id}', $i, $urlok); } $html = file_get_html($urlAScroller); $links = array(); foreach($html->find('a[href^="http://youwatch.org"]') as $a) { $links[1] = $a->href; } foreach($html->find('a[href^="http://exashare.com"]') as $a) { $links[2] = $a->href; } foreach($html->find('a[href^="https://openload.co"]') as $a) { $links[3] = $a->href; } echo "</BR></BR>{$links['1']}</BR>"; echo "{$links['2']}</BR>"; echo "{$links['3']}"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/300373-help-for-my-code/ Share on other sites More sharing options...
Muddy_Funster Posted January 15, 2016 Share Posted January 15, 2016 alright, I'm guessing ther is a language barrier here, but this line: $urlok = 'http://full-stream.org/{id}-{titleok}.html'; for($i=1; $i<=$nbArticle; $i++; $titleok) { is wrong. What is id? {titleok} should be {$titleok} and a for loop only takes in 3 parameters so $titleok should not be there Other than that, I'm not sure what your question is or why you posted in the regex section. Quote Link to comment https://forums.phpfreaks.com/topic/300373-help-for-my-code/#findComment-1529758 Share on other sites More sharing options...
cyberRobot Posted January 15, 2016 Share Posted January 15, 2016 (edited) Also note that you are missing a semi-colon here: $titleok = "les-huit-salopards" ...but this line: $urlok = 'http://full-stream.org/{id}-{titleok}.html'; for($i=1; $i<=$nbArticle; $i++; $titleok) { is wrong. What is id? {titleok} should be {$titleok} "{id}" and "{titleok}" seem to be a placeholder. Inside the foreach loop, "{id}" is supposed to be replaced with the value of $i. But snoVop doesn't seem to do anything with "{titleok}". With that said, I'm having a difficult time understanding the question also... It might help to know where $nbArticle comes from. Also, you are overwriting $urlAScroller in the following for loop: for($i=1; $i<=$nbArticle; $i++) { $urlAScroller = str_replace('{id}', $i, $urlok); } The rest of your code will only be working with the last value that $urlAScroller is set to. Edited January 15, 2016 by cyberRobot Quote Link to comment https://forums.phpfreaks.com/topic/300373-help-for-my-code/#findComment-1529765 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.