-
Notifications
You must be signed in to change notification settings - Fork 1
/
avito.php
59 lines (46 loc) · 1.92 KB
/
avito.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
$g=file_get_contents("https://seller.pokupo.ru/api/goods/8591/search/?type_goods_info=yes");
$s=file_get_contents("https://seller.pokupo.ru/api/shop/shipping/list/8591/");
$rg=json_decode($g,$assoc=true);
$rs=json_decode($s,$assoc=true);
header("Content-Type: text/xml");
echo '<Ads formatVersion="3" target="Avito.ru">';
foreach($rg as $key=>$val)
{
if($val["type_goods"]["name"]=="самовывоз" && $val["type_goods"]['parameters'][1]['name']=="avito" && $val["type_goods"]['parameters'][1]['value']==1)
{
echo '
<Ad>
<Id>'.$val['id'].'</Id>
<AdStatus>Free</AdStatus>
<AllowEmail>Нет</AllowEmail>';
foreach($rs['methods_shipping'] as $k=>$v)
{
if($v['name_method_shipping']=="Самовывоз")
{
echo '<Region>'.$v['shipping_pickup_list'][0]['name_region'].'</Region>
<City>'.$v['shipping_pickup_list'][0]['name_city'].'</City>
<ContactPhone>'.$v['shipping_pickup_list'][0]['contact_phone'].'</ContactPhone>';
}
}
echo '
<Category>'.$val["type_goods"]['parameters'][2]['value'].'</Category>
<GoodsType>'.$val["type_goods"]['parameters'][3]['value'].'</GoodsType>
<Title>'.$val['chort_name'].'</Title>
<Description>'.strip_tags($val['description']).'</Description>
<Price>'.$val['sell_cost'].'</Price>
<Images>
<Image url="https:'.$val["route_big_image"].'" />';
$gal=file_get_contents("https://seller.pokupo.ru/api/goods/".$val['id']."/info/11000000/");
$img=json_decode($gal,$assoc=true);
foreach($img['gallery'] as $k=>$v)
{
$p=preg_replace("/gallery/","big/gallery", $v['route_photo']);
echo '<Image url="https:'.$p.'" />';
}
echo '</Images>
</Ad>';
}
}
echo '</Ads>';
?>