mardi 20 novembre 2018

problem with return variable in laravel 5.7

I use Laravel 5.7. Websites are visible when the program is in progress but When done (return function) don't show all website in page. I think The problem of the return episode but I can't fix it.

Function

public function sls(Request $request){
    $ip = $request->input('ip');
    $cnt=1;
    $count=0;
    ini_set('max_execution_time', 600);
    $nextpage=true;
    while($nextpage==true){
        if($cnt==1)
            $url="https://www.bing.com/search?q=ip%3A".$ip."&qs=n&form=QBRE&pq=ip%3A".$ip."&sc=0-0&sp=-1&sk=";
        else
            $url="https://www.bing.com/search?q=ip%3a".$ip."&qs=n&sp=-1&pq=ip%3a".$ip."&sc=0-15&sk=&cvid=75D6BFCE5DF344E083DF2C10D5B735E9&first=".$cnt."&FORM=PERE";

        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
        $result=curl_exec($ch);
        $myPattern = "#<cite>(.*?)</cite>#" ;

        if(preg_match_all($myPattern,$result,$find)){
            $urls = preg_replace("/<\/?strong>/","",$find[1]);
            $keys = array_filter($urls);
            $html = '<ul>';
            foreach($keys as $value){
                $count += 1;
                $html .= '<li> '.$count.'.'.$value.' </li>';
            }
            $html .= '</ul>';
            echo $html;
        }
        if(preg_match('/class="sb_pagN sb_pagN_bp b_widePag sb_bp "/',$result))
            $cnt+=40;
        else
            $nextpage=false;
    }
    return back()->with('list', $html);

Form

<form action = "" method = "post">
<input type = "hidden" name = "_token" value = "<?php echo csrf_token() ?>">

<table>
    <tr>
        <td>Server list site: </td>
        <td><input type="text"  name="ip" /></td>
    </tr>
</table>

{!! session('list') !!}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire