$ch = curl_init(); // params example $post = [ 'username' => 'user1', 'password' => 'pass1' ]; // Request URL curl_setopt($ch, CURLOPT_URL, "http://www.example.com/"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); // server response curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_response = curl_exec ($ch); curl_close ($ch);
set_time_limit(0); // unlimited max execution time $options = array( CURLOPT_FILE => '/path/to/download/the/file/to.zip', CURLOPT_TIMEOUT => 28800, // set this to 8 hours so we dont timeout on big files CURLOPT_URL => 'http://remoteserver.com/path/to/big/file.zip', ); $ch = curl_init(); curl_setopt_array($ch, $options); curl_exec($ch); curl_close($ch);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <script type="text/javascript"> setTimeout(function() { var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null); document.getElementById("ctl00_BtnFichier").dispatchEvent(evt); },10000); </script> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=8" /><meta http-equiv="Cache-Control" content="private" /><meta http-equiv="Pragma" content="no-cache" /><title> - Page des exports </title><link rel="stylesheet" href="Styles/styleNew.css" type="text/css" /> <script language="javascript" type="text/javascript"src="Scripts/JScript.js"></script> <script type="text/javascript"> // Used to define the method to cause postback function doPostBack() { WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$btnDummyToPostBack", "", true, "", "", false, true)) } function confirmSubmit(msg) { if (confirm(msg)) { __doPostBack('LinkButton_PostBack', ''); } return; } function detection_Version_Office() { try { var Excel = new ActiveXObject("excel.application"); //Create EXCEL object Excel.Visible = false; document.getElementById('Hidversion').value = Excel.version; } catch (e) { alert(e.Description); } finally { if (Excel !== null) { Excel.Quit(); Excel = null; } } } </script> </head> <body> <form name="aspnetForm" method="post" action="https://adresse du site/Export.aspx?Script=14" id="aspnetForm"><input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" /><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="hyeIQv0wrexXklUqzuG2mg+pBLhxr6akZNmUuV/Qz8CMOUIzuhO9XTJO13HcGUIw==" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> <div id="ctl00_PanelOnglets" style="width:100%;"> <div id="ctl00_updatePanel_Result"> <div id="ctl00_Panel_Results" class="resultats" style="height:50px;overflow:auto;"> <table width="98%"> <tr> <td style="height: 16px"> <br /> <input type="submit" name="ctl00$BtnFichier" value="Télécharger le fichier" id="ctl00_BtnFichier" /> </td> <td align="right" style="height: 16px"> </td> </tr> </table> <table id="ctl00_Table_Results" border="0"> </table> </div> </div> </div> </form> </body> </html>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question<?php // Initialiser cURL $curl = curl_init(); // Définir l'adresse à ouvrir curl_setopt($curl, CURLOPT_URL, "https://www.google.fr/"); // Suivre les redirections s'il y en a @curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // Exécuter $result = curl_exec($curl); // Fermer pour libérer des ressources systèmes curl_close($curl); // Afficher le code source de la page echo htmlentities($result); ?>