{"id":810,"date":"2022-09-05T11:03:22","date_gmt":"2022-09-05T11:03:22","guid":{"rendered":"https:\/\/sunucucozumleri.com\/?p=810"},"modified":"2022-10-09T19:37:05","modified_gmt":"2022-10-09T19:37:05","slug":"php-curl-ile-dosya-indirme","status":"publish","type":"post","link":"https:\/\/sunucucozumleri.com\/blog\/php-curl-ile-dosya-indirme\/","title":{"rendered":"PHP Curl ile Dosya \u0130ndirme"},"content":{"rendered":"<p>Merhabalar Bug\u00fcn bilgi bankam\u0131za ekleyece\u011fimiz makale\u00a0<strong>Php CURL kullanarak Dosya \u00c7ekme<\/strong>\u00a0ve \u0130ndirme i\u015flemini ger\u00e7ekle\u015ftirmek.<br \/>\nMakalemizde, CURL Y\u00f6ntemini kullanaca\u011f\u0131z.<br \/>\nG\u00fczel bir \u00f6rnek ile devam edelim.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<pre>$link=$_GET['v']; \/\/ \u0130ndirmek istedi\u011fimiz dosyan\u0131n linki\r\n \r\nfunction file_download($link,$name=null)\r\n{\r\n \r\n$link_info = pathinfo($link);\r\n$uzanti = strtolower($link_info['extension']); \r\n$file = ($name) ? $name.'.'.$uzanti : $link_info['basename'];\r\n$yol = \"dosya\/\".$file;\r\n \r\n$curl = curl_init($link);\r\n$fopen = fopen($yol,'w');\r\n \r\ncurl_setopt($curl, CURLOPT_HEADER,0);\r\ncurl_setopt($curl, CURLOPT_RETURNTRANSFER,1);\r\ncurl_setopt($curl, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_0);\r\ncurl_setopt($curl, CURLOPT_FILE, $fopen);\r\n \r\ncurl_exec($curl);\r\ncurl_close($curl);\r\nfclose($fopen);\r\n \r\n}\r\n \r\n \r\n$rasgele_sayi = rand(1,10000000); \/\/ Rastgele sayi olusturup, degiskene atiyoruz.\r\n \r\nfile_download($link,$rasgele_sayi);\r\necho \"Cekilen dosya baglantisi: \".$link;\r\necho \"&lt;br&gt;Yeni dosya ismi: \".$rasgele_sayi;\r\n \r\n<\/pre>\n<p>Bol trafikli g\u00fcnler dileriz.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Merhabalar Bug\u00fcn bilgi bankam\u0131za ekleyece\u011fimiz makale\u00a0Php CURL kullanarak Dosya \u00c7ekme\u00a0ve \u0130ndirme i\u015flemini ger\u00e7ekle\u015ftirmek. Makalemizde, CURL Y\u00f6ntemini kullanaca\u011f\u0131z. G\u00fczel bir \u00f6rnek ile devam edelim. &nbsp; \u00a0 $link=$_GET[&#8216;v&#8217;]; \/\/ \u0130ndirmek istedi\u011fimiz dosyan\u0131n linki function file_download($link,$name=null) { $link_info = pathinfo($link); $uzanti = strtolower($link_info[&#8216;extension&#8217;]); $file = ($name) ? $name.&#8217;.&#8217;.$uzanti : $link_info[&#8216;basename&#8217;]; $yol = &#8220;dosya\/&#8221;.$file; $curl = curl_init($link); $fopen = &hellip;<\/p>\n","protected":false},"author":1,"featured_media":1456,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-810","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"acf":[],"_links":{"self":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/posts\/810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/comments?post=810"}],"version-history":[{"count":0,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/posts\/810\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/media\/1456"}],"wp:attachment":[{"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/media?parent=810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/categories?post=810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunucucozumleri.com\/blog\/wp-json\/wp\/v2\/tags?post=810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}