• 23-12-2023, 17:36:12
    #1
    Merhabalar;
    Json dosyasının bulunduğu bir siteden veri alırken ayarlarımı postman ile yaparken alabiliyorum ama curl ile denediğimde 403 Error - The request could not be satiffied hatası alıyorum ve altta Generated by cloudfront (CloudFront) yazısı var. Bu cloudflare gibi bir şey mi? Postmanda nasıl çalışıyor. Cookie ile ilgili bişey mi.

    <?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => 'site-adresi',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => array(
        'X-Requested-With: XMLHttpRequest',
        'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
        'Origin: site-adresi',
        'Referer: site/canli-piyasalar/',
        'Cookie: asdasdasdasdad'
      ),
    ));
    
    $response = curl_exec($curl);
    
    curl_close($curl);
    echo $response;
  • 23-12-2023, 20:38:15
    #2
    malaty adlı üyeden alıntı: mesajı görüntüle
    Merhabalar;
    Json dosyasının bulunduğu bir siteden veri alırken ayarlarımı postman ile yaparken alabiliyorum ama curl ile denediğimde 403 Error - The request could not be satiffied hatası alıyorum ve altta Generated by cloudfront (CloudFront) yazısı var. Bu cloudflare gibi bir şey mi? Postmanda nasıl çalışıyor. Cookie ile ilgili bişey mi.

    <?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => 'site-adresi',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => array(
        'X-Requested-With: XMLHttpRequest',
        'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
        'Origin: site-adresi',
        'Referer: site/canli-piyasalar/',
        'Cookie: asdasdasdasdad'
      ),
    ));
    
    $response = curl_exec($curl);
    
    curl_close($curl);
    echo $response;
    <?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => 'http://site-adresi',  // Sitename tam adresi ile güncellendi
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_POSTFIELDS => array(
        'parametre1' => 'deger1',
        'parametre2' => 'deger2',
        // ... diğer parametreler
      ),
      CURLOPT_HTTPHEADER => array(
        'X-Requested-With: XMLHttpRequest',
        'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
        'Origin: site-adresi',
        'Referer: http://site-adresi/canli-piyasalar/',
        'Cookie: asdasdasdasdad',
      ),
    ));
    
    $response = curl_exec($curl);
    
    $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    $responseHeaders = curl_getinfo($curl, CURLINFO_HEADER_OUT);
    
    echo 'HTTP Code: ' . $httpCode . PHP_EOL;
    echo 'Response Headers: ' . $responseHeaders . PHP_EOL;
    echo 'Response: ' . $response . PHP_EOL;
    
    curl_close($curl);
    bu şekilde düzenleyip kodun içerisindeki hata kodunu daha detaylı görebilirsiniz.
  • 23-12-2023, 22:31:15
    #3
    HTTP Code: 403 Response Headers: Response:
    Request blocked. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
    If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
  • 23-12-2023, 22:32:36
    #4
    siteyi isteyene pm atarım. Yardımcı olanlara şimdiden teşekkür eder, ben de onlara yardımcı olmak isterim