2 | function file_get_contents_curl($url) { |
5 | curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE); |
6 | curl_setopt($ch, CURLOPT_HEADER, 0); |
7 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
8 | curl_setopt($ch, CURLOPT_URL, $url); |
9 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
10 | curl_setopt($ch, CURLOPT_COOKIEJAR, $tmpfname); |
11 | curl_setopt($ch, CURLOPT_COOKIEFILE, $tmpfname); |
12 | $data = curl_exec($ch); |
17 | $tmpfname = tempnam("/tmp", "FOO"); |
18 | $handle = fopen($tmpfname, "w"); |
22 | $producturl = 'http://cavablar.net'; |
23 | $get = file_get_contents_curl($producturl); |
Yuxarıdakı kod normalda temp faylına cavablar.net saytından əldə olunan COOKİE-ləri yazmalı idi. Amma temp faylı boş göstərir php skript-i çalışdırdıqdan sonra.
Verilmiş cavablar və yazılan şərhlər (2 cavab var)
1
Kodu yoxladım işləyir məndə. Sadəcə faylı göstərilən temp qovluğuna yox elə kompun öz temp qovluğuna yerləşdirir.
Nəticə: C:\Users\User-Name\AppData\Local\Temp\FOO72AD.tmp
içində olan
1
# Netscape HTTP Cookie File
2
# http://curl.haxx.se/docs/http-cookies.html
3
# This file was generated by libcurl! Edit at your own risk.
4
5
cavablar.net FALSE / FALSE 0 PHPSESSID 2ncceh2338u7uerfa925tpllm2
0
problem serverde idi. nginx permissions. ozum hell eledim. coxsagolun
Sual verin
Cavab verin