folder Tahribat.com Forumları
linefolder Asp - Php - Cgi - Perl
linefolder Uzaktan Veri Çekimi Sorunu Php



Uzaktan Veri Çekimi Sorunu Php

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    EcHoLL
    EcHoLL's avatar
    Kayıt Tarihi: 04/Eylül/2008
    Erkek
    <?php
    include('ip2locationlite.class.php');
     
    //Load the class
    $ipLite = new ip2location_lite;
    $ipLite->setKey('<your_api_key>');
     
    //Get errors and locations
    $locations = $ipLite->getCity($_SERVER['REMOTE_ADDR']);
    $errors = $ipLite->getError();
     
    //Getting the result
    echo "<p>\n";
    echo "<strong>First result</strong><br />\n";
    if (!empty($locations) && is_array($locations)) {
      foreach ($locations as $field => $val) {
        echo $field . ' : ' . $val . "<br />\n";
      }
    }
    echo "</p>\n";
     
    //Show errors
    echo "<p>\n";
    echo "<strong>Dump of all errors</strong><br />\n";
    if (!empty($errors) && is_array($errors)) {
      foreach ($errors as $error) {
        echo var_dump($error) . "<br /><br />\n";
      }
    } else {
      echo "No errors" . "<br />\n";
    }
    echo "</p>\n";

    Test php


    <?php
    final class ip2location_lite{
    	protected $errors = array();
    	protected $service = 'api.ipinfodb.com';
    	protected $version = 'v3';
    	protected $apiKey = '';
    
    	public function __construct(){}
    
    	public function __destruct(){}
    
    	public function setKey($key){
    		if(!empty($key)) $this->apiKey = $key;
    	}
    
    	public function getError(){
    		return implode("\n", $this->errors);
    	}
    
    	public function getCountry($host){
    		return $this->getResult($host, 'ip-country');
    	}
    
    	public function getCity($host){
    		return $this->getResult($host, 'ip-city');
    	}
    
    	private function getResult($host, $name){
    		$ip = @gethostbyname($host);
    
    		if(preg_match('/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/', $ip)){
    			$xml = @file_get_contents('http://' . $this->service . '/' . $this->version . '/' . $name . '/?key=' . $this->apiKey . '&ip=' . $ip . '&format=xml');
    
    			try{
    				$response = @new SimpleXMLElement($xml);
    
    				foreach($response as $field=>$value){
    					$result[(string)$field] = (string)$value;
    				}
    
    				return $result;
    			}
    			catch(Exception $e){
    				$this->errors[] = $e->getMessage();
    				return;
    			}
    		}
    
    		$this->errors[] = '"' . $host . '" is not a valid IP address or hostname.';
    		return;
    	}
    }
    ?>
    fonksiyon.php
     
    beyler bu zımbırtı localde çalışıyor sorunsuz ama sunucuya atınca karşı makineden veri çekmiyor curl aktif sunucuda

    "Hayat zor olabilir ama ben de kolay sayılmam." insanları Silahsızlandırmak onları köleleştirmek için En iyi Yoldur.
  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    end
    end's avatar
    Kayıt Tarihi: 16/Ekim/2016
    Erkek
    EcHoLL bunu yazdı
    \n";
    if (!empty($locations) && is_array($locations)) {
      foreach ($locations as $field => $val) {
        echo $field . ' : ' . $val . "
    \n"; } } echo "\n"; //Show errors echo "

    \n"; echo "Dump of all errors
    \n"; if (!empty($errors) && is_array($errors)) { foreach ($errors as $error) { echo var_dump($error) . "

    \n"; } } else { echo "No errors" . "
    \n"; } echo "

    \n";

    Test php


     
    fonksiyon.php
     
    beyler bu zımbırtı localde çalışıyor sorunsuz ama sunucuya atınca karşı makineden veri çekmiyor curl aktif sunucuda

    error log yok mu hocam


    0x0480 takilin madem ﷽﷽﷽
  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    EcHoLL
    EcHoLL's avatar
    Kayıt Tarihi: 04/Eylül/2008
    Erkek

    First result

    Dump of all errors
    No errors

     

    error vermiyor ne yazıkki file_get ile çekmiyor sanırım localde sorunsuz çalışıyor


    "Hayat zor olabilir ama ben de kolay sayılmam." insanları Silahsızlandırmak onları köleleştirmek için En iyi Yoldur.
  4. KısayolKısayol reportŞikayet pmÖzel Mesaj
    EcHoLL
    EcHoLL's avatar
    Kayıt Tarihi: 04/Eylül/2008
    Erkek

    Curl ile veri çekimi çalışıyor sunucuda file_get kapalı fonksiyonlardan bunu curl olarak editlemek lazım


    "Hayat zor olabilir ama ben de kolay sayılmam." insanları Silahsızlandırmak onları köleleştirmek için En iyi Yoldur.
  5. KısayolKısayol reportŞikayet pmÖzel Mesaj
    EcHoLL
    EcHoLL's avatar
    Kayıt Tarihi: 04/Eylül/2008
    Erkek

    bu fonksiyon php dosyasını curl ile çalışır hale getiricek bir arkadaş lazım bana :)


    "Hayat zor olabilir ama ben de kolay sayılmam." insanları Silahsızlandırmak onları köleleştirmek için En iyi Yoldur.
  6. KısayolKısayol reportŞikayet pmÖzel Mesaj
    pSkpt
    pSkpt's avatar
    Kayıt Tarihi: 10/Aralık/2010
    Erkek

    http://www.jonasjohn.de/snippets/php/curl-example.htm

    function curl_download($Url){
     
        // is cURL installed yet?
        if (!function_exists('curl_init')){
            die('Sorry cURL is not installed!');
        }
     
        // OK cool - then let's create a new cURL resource handle
        $ch = curl_init();
     
        // Now set some options (most are optional)
     
        // Set URL to download
        curl_setopt($ch, CURLOPT_URL, $Url);
     
        // Set a referer
        curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm");
     
        // User agent
        curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
     
        // Include header in result? (0 = yes, 1 = no)
        curl_setopt($ch, CURLOPT_HEADER, 0);
     
        // Should cURL return or print out the data? (true = return, false = print)
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     
        // Timeout in seconds
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
     
        // Download the given URL, and return output
        $output = curl_exec($ch);
     
        // Close the cURL resource, and free system resources
        curl_close($ch);
     
        return $output;
    }

     

    $xml = @file_get_contents('http://' . $this->service . '/' . $this->version . '/' . $name . '/?key=' . $this->apiKey . '&ip=' . $ip . '&format=xml');

    bunun yerine

    $xml = curl_download('http://' . $this->service . '/' . $this->version . '/' . $name . '/?key=' . $this->apiKey . '&ip=' . $ip . '&format=xml');

    kullanmayı dener misin?


    İmza...
  7. KısayolKısayol reportŞikayet pmÖzel Mesaj
    ManiakRhifat
    ManiakRhifat's avatar
    Kayıt Tarihi: 22/Ağustos/2005
    Erkek

    $xml = file_get_contents() kısmını aşağıdaki kod ile değiştirebilirsin. fonksiyon başına @ işareti koyduğun için hata kodu üretmiyor.

     

    $xmlUrl = 'http://' . $this->service . '/' . $this->version . '/' . $name . '/?key=' . $this->apiKey . '&ip=' . $ip . '&format=xml';

    $curl = curl_init();

    curl_setopt_array($curl, array(

        CURLOPT_RETURNTRANSFER => 1,

        CURLOPT_URL => $xmlUrl

    ));

    $xml = curl_exec($curl);

    curl_close($curl);

     

     


    eğer bir domates ışık hızına ulaşırsa kendisi ışık olur. bu sebeple ampulü yakdığınızda yanınızdan geçenlerin ışık mı yoksa domates mi oldunu bilemezsiniz. eğer ışık diyorsanız ışıktır, domates diyorsanız domatezdir. buna röletivite deriz.
  8. KısayolKısayol reportŞikayet pmÖzel Mesaj
    EcHoLL
    EcHoLL's avatar
    Kayıt Tarihi: 04/Eylül/2008
    Erkek

    Sağollasınız Arkadaşlar deniyorum şimdi yazarım


    "Hayat zor olabilir ama ben de kolay sayılmam." insanları Silahsızlandırmak onları köleleştirmek için En iyi Yoldur.
  9. KısayolKısayol reportŞikayet pmÖzel Mesaj
    EcHoLL
    EcHoLL's avatar
    Kayıt Tarihi: 04/Eylül/2008
    Erkek
    ManiakRhifat bunu yazdı

    $xml = file_get_contents() kısmını aşağıdaki kod ile değiştirebilirsin. fonksiyon başına @ işareti koyduğun için hata kodu üretmiyor.

     

    $xmlUrl = 'http://' . $this->service . '/' . $this->version . '/' . $name . '/?key=' . $this->apiKey . '&ip=' . $ip . '&format=xml';

    $curl = curl_init();

    curl_setopt_array($curl, array(

        CURLOPT_RETURNTRANSFER => 1,

        CURLOPT_URL => $xmlUrl

    ));

    $xml = curl_exec($curl);

    curl_close($curl);

     

     

    senin gönerdiğin fonksiyon çalıştı

     

    fonksiyonun curl ile çalışır hali https://ghostbin.com/paste/sj43y lazım olanlar kullanır


    "Hayat zor olabilir ama ben de kolay sayılmam." insanları Silahsızlandırmak onları köleleştirmek için En iyi Yoldur.
Toplam Hit: 938 Toplam Mesaj: 9
php curl fileget