<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:wfw="http://wellformedweb.org/CommentAPI/">
<channel>
<title>dwt&#039;s life - Google Service</title>
<link>https://dwt.life/tag/Google-Service/</link>
<atom:link href="https://dwt.life/feed/tag/Google-Service/" rel="self" type="application/rss+xml" />
<language>zh-CN</language>
<description></description>
<lastBuildDate>Tue, 18 Oct 2022 17:37:39 +0800</lastBuildDate>
<pubDate>Tue, 18 Oct 2022 17:37:39 +0800</pubDate>
<item>
<title>谷歌下拉联想词接口</title>
<link>https://dwt.life/archives/314/</link>
<guid>https://dwt.life/archives/314/</guid>
<pubDate>Tue, 18 Oct 2022 17:37:39 +0800</pubDate>
<dc:creator>Ricky</dc:creator>
<description><![CDATA[接口一http://suggestqueries.google.com/complete/search?client=firefox&amp;q=YOURQUERY&amp;callback=接...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h2>接口一</h2><p><code>http://suggestqueries.google.com/complete/search?client=firefox&amp;q=YOURQUERY&amp;callback=</code></p><h2>接口二</h2><p><code>https://www.google.com/complete/search?client=hp&amp;hl=en&amp;sugexp=msedr&amp;gs_rn=62&amp;gs_ri=hp&amp;cp=1&amp;gs_id=9c&amp;q=a&amp;xhr=t&amp;callback=hello</code></p><p><code>callback</code>参数可以去掉或者改成jsonp</p><pre><code class="lang-html">&lt;div id=&quot;output&quot;&gt;&lt;/div&gt;

&lt;script&gt;
/* this function shows the raw data */
function myAmazingFunction(data){
    document.getElementById(&#039;output&#039;).innerHTML = data;
}
&lt;/script&gt;

&lt;script src=&quot;https://www.google.com/complete/search?client=hp&amp;hl=en&amp;sugexp=msedr&amp;gs_rn=62&amp;gs_ri=hp&amp;cp=1&amp;gs_id=9c&amp;q=a&amp;xhr=t&amp;callback=hello&amp;callback=myAmazingFunction&quot;&gt;&lt;/script&gt;</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://dwt.life/archives/314/#comments</comments>
<wfw:commentRss>https://dwt.life/feed/tag/Google-Service/</wfw:commentRss>
</item>
<item>
<title>PHP Google merchant 添加商品</title>
<link>https://dwt.life/archives/308/</link>
<guid>https://dwt.life/archives/308/</guid>
<pubDate>Sun, 04 Sep 2022 12:13:00 +0800</pubDate>
<dc:creator>Ricky</dc:creator>
<description><![CDATA[&lt;?phprequire_once &#039;vendor/autoload.php&#039;;putenv(&#039;GOOGLE_APPLICATION_CREDENTIALS=...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<pre><code class="lang-php">&lt;?php
require_once &#039;vendor/autoload.php&#039;;

putenv(&#039;GOOGLE_APPLICATION_CREDENTIALS=Merchant-Center-XXXXXx.json&#039;);

$client = new Google_Client();
$client-&gt;useApplicationDefaultCredentials();

$client-&gt;addScope(&#039;https://www.googleapis.com/auth/content&#039;);

$service = new Google_Service_ShoppingContent($client);

$product = new Google_Service_ShoppingContent_Product();
$product-&gt;setOfferId(&#039;book123&#039;);
$product-&gt;setTitle(&#039;A Tale of Two Cities&#039;);
$product-&gt;setDescription(&#039;A classic novel about the French Revolution&#039;);
$product-&gt;setLink(&#039;http://my-book-shop.com/tale-of-two-cities.html&#039;);
$product-&gt;setImageLink(&#039;http://my-book-shop.com/tale-of-two-cities.jpg&#039;);
$product-&gt;setContentLanguage(&#039;en&#039;);
$product-&gt;setTargetCountry(&#039;GB&#039;);
$product-&gt;setChannel(&#039;online&#039;);
$product-&gt;setAvailability(&#039;in stock&#039;);
$product-&gt;setCondition(&#039;new&#039;);
$product-&gt;setGoogleProductCategory(&#039;Media &gt; Books&#039;);
$product-&gt;setGtin(&#039;9780007350896&#039;);

$price = new Google_Service_ShoppingContent_Price();
$price-&gt;setValue(&#039;2.50&#039;);
$price-&gt;setCurrency(&#039;GBP&#039;);

$shipping_price = new Google_Service_ShoppingContent_Price();
$shipping_price-&gt;setValue(&#039;0.99&#039;);
$shipping_price-&gt;setCurrency(&#039;GBP&#039;);

$shipping = new Google_Service_ShoppingContent_ProductShipping();
$shipping-&gt;setPrice($shipping_price);
$shipping-&gt;setCountry(&#039;GB&#039;);
$shipping-&gt;setService(&#039;Standard shipping&#039;);

$shipping_weight = new Google_Service_ShoppingContent_ProductShippingWeight();
$shipping_weight-&gt;setValue(200);
$shipping_weight-&gt;setUnit(&#039;grams&#039;);

$product-&gt;setPrice($price);
$product-&gt;setShipping(array($shipping));
$product-&gt;setShippingWeight($shipping_weight);

$result = $service-&gt;products-&gt;insert($merchant_id, $product);</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://dwt.life/archives/308/#comments</comments>
<wfw:commentRss>https://dwt.life/feed/tag/Google-Service/</wfw:commentRss>
</item>
</channel>
</rss>