PHP - curl

    
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, 'https://google.com');
    
    // The contents of the "User-Agent: " header to be used in a HTTP request
    curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)');
    
    // send post request
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, ['a' => 'hello', 'b' => 'world']);
    
    // The contents of the "Referer: " header to be used in a HTTP request.
    curl_setopt($curl, CURLOPT_REFERER, 'https://google.com');
    
    // automatically follow redirects
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    
    // return response
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    
    $data = curl_exec($curl);
    curl_close($curl);
    

Comments