Skip to content

Instantly share code, notes, and snippets.

<?php
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com/wp-json/wp/v2/'
]);
$response = $client->get('media',[
'query' => ['search' => 'sample']
]);
$result = json_decode($response->getBody()->getContents());
return (count($result)) ? $result[0]->id : null;
<?php
$client = new \GuzzleHttp\Client();
$response = $client->get('https://example.com/sample.jpg');
$image = $response->getBody()->getContents();
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com/wp-json/wp/v2/'
]);
$response = $client->post('media',[
'auth' => [$user, $password],
<?php
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com/wp-json/wp/v2/'
]);
$client->post('posts',[
'auth' => [$user, $password],
'form_params' => [
'title' => 'WP REST API Example',
'content' => '<p>サンプル記事。Guzzle使用</p>',
'date' => '2019-07-10T20:00:00+09:00',
<?php
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com/wp-json/wp/v2/'
]);
$client->post('posts',[
'auth' => [$user, $password],
'form_params' => [
'title' => 'WP REST API Example',
'content' => '<p>サンプル記事。Guzzle使用</p>',
'status' => 'publish',
version: 2.1
orbs:
aws-cli: circleci/aws-cli@0.1.13
jobs:
build:
working_directory: ~/repo
environment:
- AWS_S3_BUCKET_NAME: your-s3-bucket-name
docker:
- image: innovatorjapan/awscli:latest
options: {
elements: {
line: {
tension: 0
}
}
}
<template>
<div class="small">
<line-chart
v-if="loaded"
:chart-data="datacollection"
:options="options"/>
</div>
</template>
<script>
options: {
elements: {
line: {
fill: false
}
}
}
datacollection: {
labels: ['2019/06/01','2019/06/02','2019/06/03','2019/06/04','2019/06/04'],
datasets: [{
label: '来店者数',
data: [9, 47, 11, 24, 67],
fill: false
},
{
label: '売上高',
data: [1700, 56000, 2200, 32000, 34000, 112000],
<?php
$goutte = GoutteFacade::request('GET',$review_url);
$star = $goutte->filter('.crAvgStars')->filter('img')->attr('src');