我不确定这是不是要问的地方,但Etsy开发人员的支持是非常缓慢的回复(等待4天,这只是为了看看我是否可以继续该项目 - 因为我不想要打破他们的TOS).无论如何,除此之外......
我有一个我要向用户提供的脚本,它会调用以下源:(使用此处的详细信息:https://www.etsy.com/developers/documentation/getting_started/requests)
https://openapi.etsy.com/v2/shops/%s/listings/active?method=GET&api_key=$etsy_key&limit=200
Run Code Online (Sandbox Code Playgroud)
然后,这将获得他们在他们的商店出售的物品.到现在为止还挺好.一个小问题......没有图像!!! 现在,根据他们的文档(https://www.etsy.com/developers/documentation/getting_started/images),它说你必须为每个项目做一个单独的请求!
https://openapi.etsy.com/v2/listings/ITEM_ID/images/?api_key=xxxx
Run Code Online (Sandbox Code Playgroud)
当然那不可能是对的吗?所以我们必须这样做:
肯定有必要有更好的方法吗?
我很乐意接受建议,因为这让我感到疯狂.
这让我疯了!我有一个需要创建随机ID的脚本,以便可以重命名该文件.这是我的测试:
for (my $i = 0; $i <= 100; $i++) {
my $test = rand_id();
print "FOO: $test\n";
}
sub rand_id {
# Used for the file names (not temp_id, for new adds)
use String::Random qw(random_regex random_string);
my $rand = random_regex("[a-zA-Z0-9]"x20);
return $rand;
}
Run Code Online (Sandbox Code Playgroud)
这符合我的希望:
root@admin:# perl test.cgi
FOO: P2kyuotdlk04gcafvoze
FOO: ZGC44tXfGFaiXeHsLZdn
FOO: fydWFp1PW6iGYFaOfgvx
FOO: xG4SPx2gLGPVeMJOupZ9
FOO: 6A2uD9hCF90VP7ybKjiA
FOO: wT4fG8ogmV37Mkljs0gE
FOO: 6QttcmlNjO1o9jCVht3g
FOO: 9bAYYDd2NIjBWgAhsl3t
FOO: hrU04kHvxu0JJYPHv6Jk
FOO: 9EVL9GqGdWWZhDam6dc9
FOO: F0zruszqvmMOUumlO4Q1
FOO: KA9jOof9iSTxpDOWUMBl
FOO: phicMiogMhZIcPZiXvj8
etc
Run Code Online (Sandbox Code Playgroud)
所以好(没有重复).
然后我在我的脚本中有几乎相同的代码(只是不在循环中),但是当我继续从浏览器重新加载时,我得到:
NEW: 0ab3K60sJSpHrvDVCKcR
NEW: …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用这个模块:
https://github.com/paypal/paypal-checkout
我正在尝试找出如何关闭客户的送货地址。我知道您可以在 URL 中按顺序执行版本&NOSHIPPING=1,但我找不到有关 API 4 版本的任何信息。我的代码是:
paypal.Button.render({
// Pass the client ids to use to create your transaction on sandbox and production environments
locale: 'fr_FR',
//env: 'production',
env: 'sandbox',
client: {
sandbox: "...",
production: "..."
},
// Pass the payment details for your transaction
// See https://developer.paypal.com/docs/api/payments/#payment_create for the expected json parameters
payment: function() {
return paypal.rest.payment.create(this.props.env, this.props.client, {
transactions: [
{
amount: {
total: window.my_config.grand_total,
currency: 'EUR',
details: {
"subtotal": window.my_config.price,
"tax": window.my_config.vat_amount
}
}, …Run Code Online (Sandbox Code Playgroud) 我已经使用Perl 5.22.1转移到新服务器.我有这段代码:
$html =~ m{
( # $1 the whole tag
<
(
?:
!--
( # $2 the attributes are all the data between
.*?
)
--
| # or
(
?:
( # $3 the name of the tag
/?\S+?\b
)
( # $4 the attributes
[^'">]*
(
?:
( # $5 just to match quotes
['"]
)
.*?\5
[^'">]*
)*
)
)
)
>
)
}gsx
Run Code Online (Sandbox Code Playgroud)
...现在它给了我这个错误:
A fatal error has occurred:
In '(?...)', the …Run Code Online (Sandbox Code Playgroud) 我们使用 SMTP 从我的网站发送电子邮件。使用Email::MIME构建,然后使用Email::Sender::Transport::SMTP将其传递到我们的 SMTP 服务器进行发送:
my $transport = Email::Sender::Transport::SMTP->new({
host => 'smtp.gmail.com',
port => 465,
ssl => 1,
sasl_username => 'hello@foo.com',
sasl_password => 'xxxx'
});
sendmail($email,{ to => ['andy@foo.com'] });
Run Code Online (Sandbox Code Playgroud)
我的问题是它太慢了!(每封电子邮件至少需要 4-5 秒,如果您向客户发送一封电子邮件 + 向我们(管理员)发送一封电子邮件,那就是 10 秒。我们不断让人们认为该网站似乎挂了
所以我的问题 - 如何发送 SMTP 电子邮件,而不必挂起 Perl 脚本?我真的不关心错误捕获。主要问题是尽快发送电子邮件
谢谢
看起来Perl和nginx玩的不错,这是一场永无止境的战斗:(我已经安装了一个新的开发服务器。我不会为您带来所有细节,但是可以说我已经安装了(通过apt-get);
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install nginx
sudo apt-get install php5-cli php5-cgi spawn-fcgi php-pear
sudo apt-get install mysql-server php5-mysql
sudo apt-get install fcgiwrap
Run Code Online (Sandbox Code Playgroud)
然后,我使用以下方法配置了我的站点:
server {
listen 80;
server_name site.net.net www.site.net.net;
access_log /srv/www/site.net.net/logs/access.log;
error_log /srv/www/site.net.net/logs/error.log;
root /srv/www/site.net.net/www;
location / {
index index.html index.htm;
}
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/site.net.net/www$fastcgi_script_name;
}
location ~ \.cgi$ {
try_files $uri =404;
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index …Run Code Online (Sandbox Code Playgroud) 我真的很不高兴.在最近几天(因为我最后一次使用该网站),我的Wordpress安装突然丢失了几乎所有的格式(只有顶部栏似乎工作.
CSS确实似乎正在加载,但它缺少大量的:
这是另一个网站上的同一页面(相同版本的WordPress);
我不知道是什么原因导致了这一切.前端如果罚款,只是重申一下.
更新:感谢有人在https://wordpress.stackexchange.com/,我按照这些说明操作:
请尝试以下操作:1)清除浏览器缓存.2)重新安装WordPress(保留wp-content和你的数据库,只需重新安装核心文件)
....现在已经解决了:)感谢所有提出建议的人!
我有一些示例数据(来自Google表格电子表格);
Title,Website URL,Description,Contact Number,Address 1,Address 2,City,State ,Province,Country,Facebook,Twitter,Full Category Name
Sample title,http://www.test.com,"A short description. Press Ctrl+Enter to create a new line
Like this",44 (0)1430 123 123,Some address line,Line 2,The city,The state,Some province,UK,facebook.com/test,twitter.com/test,Full Category/Path/To/Category or ID
Run Code Online (Sandbox Code Playgroud)
然后我有这个简单的脚本:
use Text::CSV;
my $csv = Text::CSV->new({
sep_char => ','
});
$csv->column_names("title","url","description","contact_number","address1","address2","city","state","province","country","facebook","twitter","category_name");
my $file = './tmp/$USER->{Username}.csv';
open (WRITEIT, ">:encoding(utf8)", $file) or die "cant write $file: $!";
print WRITEIT join("\n", @data). "\n";
close (WRITEIT) or die "cant write $file: $!";
open my $io, "<:encoding(utf8)", $file …Run Code Online (Sandbox Code Playgroud) 我正在尝试制定一个循环,让我忽略一些匹配项。到目前为止,我有:
for d in /home/chambres/web/x.org/public_html/2018/js/lib/*.js ; do
if [[ $d =~ /*.min.js/ ]];
then
echo "ignore $d"
else
filename="${d##*/}"
echo "$d"
#echo "$filename"
fi
done
Run Code Online (Sandbox Code Playgroud)
但是,当我运行它时,它们似乎仍然包含在内。我究竟做错了什么?
/home/chambres/web/x.org/public_html/2018/js/lib/underscore.js.min.js
/home/chambres/web/x.org/public_html/2018/js/lib/tiny-slider.js
/home/chambres/web/x.org/public_html/2018/js/lib/tiny-slider.js.min.js
/home/chambres/web/x.org/public_html/2018/js/lib/underscore.js
Run Code Online (Sandbox Code Playgroud)
顺便说一句,我是 bash 的新手,所以请善待;)
这是一个很愚蠢的问题——但我在画一个空白!我有一个测试字符串:
Foo|||bar||something|whatever
Run Code Online (Sandbox Code Playgroud)
我需要更换||与|EMPTY_STRING|每个实例。
我正在做:
s/\Q||/|EMPTY_STRING|/g;
Run Code Online (Sandbox Code Playgroud)
问题是,这将其转换为:
Foo|EMPTY_STRING||bar|EMPTY_STRING|something|whatever
Run Code Online (Sandbox Code Playgroud)
注意 || 在那里。我一定错过了一些愚蠢的东西。它是什么?