$q = "Киргизия ивановка";
$url = "http://nominatim.openstreetmap.org/search?q=".urlencode($q)."&format=json&polygon_geojson=1";
$ch = curl_init($url); // such as http://example.com/example.xml
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
curl_close($ch);
$a = json_decode($data);
# -*- coding: utf-8 -*-
from django.contrib import admin
from .models import ShopCat, ShopItem, ShopItemImg
class ShopItemImgInline(admin.TabularInline):
model = ShopItemImg
class ShopItemAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['title', 'cat_id', 'price']}),
("Тексты", {'fields': ['descr', 'sostav']}),
]
inlines = [ShopItemImgInline]
admin.site.register(ShopItem, ShopItemAdmin)
admin.site.register(ShopCat)
$a = array(
array(1,2,4,5,6,7),
array(2,5,7,1),
array(1,2),
array(1,'a','g',2),
);
$res = array();
for($i=0; $i<count($a[0]); $i++){
$flag = 0;
for($j=1; $j<count($a); $j++){
for($k=0; $k<count($a[$j]); $k++){
if($a[0][$i] == $a[$j][$k]){
$flag ++ ;
if($flag == 3){ array_push($res, $a[0][$i]); }
}
} // k
} // j
} // for i
print_r($res);
printf("" .$row['email5'] . "");
$to = $row['email5'];
printf("" .$row['email5'] . "");
$to[$i++] = $row['email5'];