filemaker 16 curl call(filemaker 16 curl call)
我有一个php脚本,它使用filemaker数据执行curl调用(该脚本通过php调用从我的数据库中获取数据)。
Filemaker 16直接支持curl调用。
我想使用电影制作者插入来自url脚本步骤来运行相同的调用。
我设法建立一个呼叫,但它失败了,在开始时出现错误(没有数据传输到服务器),现在没有任何通知。
我的PHP脚本:
$headers = array( 'Content-Type: text/calendar; charset=utf-8', 'Expect: ', 'Content-Length: '.strlen($body) ); $agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $userpwd); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); $res=curl_exec($ch); curl_close($ch); print_r($res);
我在filemaker上的curl选项
"--header \"Content-Type: text/calendar; charset=utf-8\" --header \"Expect: \" --header \"Content-Length: "&Length ( $vevent )&"\" --user-agent \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\" --basic --user "&$password&" --request \"PUT\" --data \"@$vevent\""
有没有人在电影制作人16中制定卷曲选项方面有经验?
我在电影制片人16中的脚本调用不起作用,我没有收到错误,但是数据没有成功上传到服务器(这是正确的数据,正确制定,相同的数据在php中工作)
I hav a php script that executes a curl call with filemaker data (the script draws data from my db via php calls).
Filemaker 16 supports curl calls directly.
I want to run the same call using filmmakers insert from url script step.
I managed to build up a call but it is failing, at the beginning with an error (there was no data transferred to the server) and now, without any notifications.
My working PHP script:
$headers = array( 'Content-Type: text/calendar; charset=utf-8', 'Expect: ', 'Content-Length: '.strlen($body) ); $agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $userpwd); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); $res=curl_exec($ch); curl_close($ch); print_r($res);
My curl options on filemaker
"--header \"Content-Type: text/calendar; charset=utf-8\" --header \"Expect: \" --header \"Content-Length: "&Length ( $vevent )&"\" --user-agent \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\" --basic --user "&$password&" --request \"PUT\" --data \"@$vevent\""
Has anybody got experience in formulating curl options in filmmaker 16?
My script call in filmmaker 16 does not work, I do not get an error, but the data is not successfully uploaded to the server (it is ical data, correctly formulated, the same data works in php)
原文:https://stackoverflow.com/questions/44062115
最满意答案
这是推出的不少主题。 它可能低于系统的线程限制 ,因此它取决于您可以为该作业提供多少资源。
如果您更喜欢使用工作池,则Parallel:ForkManager是一个流行的模块。
该模块的文档为大规模下载器提供了此示例:
use LWP::Simple; use Parallel::ForkManager; ... @links=( ["http://www.foo.bar/rulez.data","rulez_data.txt"], ["http://new.host/more_data.doc","more_data.doc"], ... ); ... # Max 30 processes for parallel download my $pm = Parallel::ForkManager->new(30); foreach my $linkarray (@links) { $pm->start and next; # do the fork my ($link,$fn) = @$linkarray; warn "Cannot get $fn from $link" if getstore($link,$fn) != RC_OK; $pm->finish; # do the exit in the child process } $pm->wait_all_children;
LWP :: UserAgent没有LWP :: Simple提供的相同
getstore
子,但它确实有一个行为相似的mirror
方法。That is quite a few threads to launch. It's probably below the thread limit for your system, so it depends how many resources you have available for the job.
If you'd rather use a worker pool, Parallel:ForkManager is a popular module for that.
The module's documentation offers this example for a mass-downloader:
use LWP::Simple; use Parallel::ForkManager; ... @links=( ["http://www.foo.bar/rulez.data","rulez_data.txt"], ["http://new.host/more_data.doc","more_data.doc"], ... ); ... # Max 30 processes for parallel download my $pm = Parallel::ForkManager->new(30); foreach my $linkarray (@links) { $pm->start and next; # do the fork my ($link,$fn) = @$linkarray; warn "Cannot get $fn from $link" if getstore($link,$fn) != RC_OK; $pm->finish; # do the exit in the child process } $pm->wait_all_children;
LWP::UserAgent doesn't have the same
getstore
sub that LWP::Simple provides, but it does have amirror
method which behaves similarly.
相关问答
更多-
我不确定为什么在第一次运行时没有得到OOM错误的第二次运行时会出现OOM错误; 当你运行Perl脚本并且perl二进制文件退出时,它会将所有内存释放回操作系统。 执行之间没有任何内容。 每次REST服务返回的数据是否完全相同? 也许第二次运行时会有更多的数据,它会让你超越边缘。 我注意到的一个问题是你正在启动10个线程并运行它们完成,然后产生10个以上的线程。 更好的解决方案可能是工作线程模型。 在程序开始时生成10个线程(或多个你想要的),将URL放入队列,并允许线程自己处理队列。 这是一个可能有帮助的简 ...
-
好的,哇。 在那里慢下来。 你在同一个代码中进行threads和fork 。 这是一个非常可怕的想法。 它们在某种程度上依赖于实现 - 你可以非常肯定它们会起作用,但同时它们都要求一个痛苦的世界。 (并发问题,竞争条件等)。 在这种特殊情况下 - 您需要了解fork()所做的是获取进程的完整副本 - 完全相同的状态 - 并且只有一个区别 - fork()的返回代码。 这意味着线程等也将被fork()克隆。 Parallel::ForkManager通过限制并行范围来隐藏其中的一部分,但这就是幕后发生的事情。 ...
-
C中的并行线程(Parallel Threads in C)[2022-06-28]
正如其他人所提到的,使用多个内核是可能的,但这取决于操作系统决定如何分配线程。 在我指示每个线程运行的位置时,你没有任何控制权。 对于一个非常好的教程,有一些很好的解释和图片,你可以查看这个页面,以及如何使用POSIX库进行多线程的代码。 http://www.pathcom.com/~vadco/parallel.html 睡眠的时间片很难看到,所以最好的办法是测试它,例如,让你的两个线程开始计算每毫秒,看两者是否相同。 如果他们不是,那么至少有一个人会被cpu睡觉。 很可能两者都会在某个时间进入睡眠状态 ... -
连接池的大小如何影响可以提供的并行请求(How size of connection pool affects parallel requests that can be served)[2023-01-25]
不是真的。 连接池通过在数据库访问上重用它们来负责消除创建和关闭连接的开销。 如果您有一千个请求,并且maxSize池为20,那么将并行执行20个数据库访问,并且每个请求释放数据库访问权限后,将重复使用相同的连接来参加另一个请求。 这假设数据库访问将在有限的时间段内进行(短操作),并且一旦获取/插入/更新数据,就会释放连接以用于另一个请求。 另一方面,由于池完全正在使用而无法检索数据库连接的请求(假设第21个请求)将处于等待状态,直到某个连接被释放,因此它在客户端是透明的条件。 所有这一切都假设代码以高效的 ... -
关于并行POSIX线程(Regarding parallel POSIX threads)[2023-10-19]
在访问多线程应用程序中的共享数据时,保护共享数据总是非常重要。 在你的情况下,你有两个线程同时访问标准输出,因此你有一个竞争条件,其中两个线程争夺stdout 。 因此,我已经自由地使您的程序适应标准输出受互斥锁保护的情况。 在使用stdout之前,我们锁定一个互斥锁,另一个线程也会尝试锁定互斥锁,但两者不能同时在同一时间完成。 因此试图锁定的第二个线程进入睡眠状态。 正如其他人告诉你的那样,你最初编写的程序可能看起来很好,或多或少巧合,在其他系统上,你无法保证这两个线程的输出可以混淆。 以输出结束 125 ... -
perl线程异常退出(perl threads exiting abnormally)[2021-08-04]
我和你的来源玩了一下,想出了这个: #!/usr/bin/perl use 5.012; use warnings; use threads; use Thread::Queue; use LWP::UserAgent; use constant THREADS => 10; my $queue = Thread::Queue->new(); my @URLs = qw( http://www.collectorsarmoury.com/ http://burgund ... -
这是推出的不少主题。 它可能低于系统的线程限制 ,因此它取决于您可以为该作业提供多少资源。 如果您更喜欢使用工作池,则Parallel:ForkManager是一个流行的模块。 该模块的文档为大规模下载器提供了此示例: use LWP::Simple; use Parallel::ForkManager; ... @links=( ["http://www.foo.bar/rulez.data","rulez_data.txt"], ["http://new.host/more_data.doc ...
-
Concurrency :: parallel_for(PPL)创建了太多线程(Concurrency::parallel_for (PPL) is creating too many threads)[2022-03-14]
我不知道是否可以将PPL / ConcRT配置为不使用协作同步或至少限制它创建的线程数。 我认为它可能是通过调度程序策略来控制的,但似乎没有任何策略参数适合此目的。 但是,我有一些建议,您可能会发现有助于缓解这个问题,即使不是以理想的方式: 而不是critical_section ,使用非协作同步原语来保护资源管理器。 我认为(虽然没有检查)经典的WinAPI CRITICAL_SECTION应该成功。 作为这个方向的根本步骤,您可以考虑使用其他并行库作为代码; 例如, 英特尔的TBB提供了大部分PPL A ... -
线程没有并行运行(Threads not running parallel)[2022-05-10]
在您启动所有线程后,您想要加入该线程。 你的代码目前所做的是启动一个线程,然后加入,然后启动下一个线程。 这实际上只是让它们按顺序运行。 但是,输出可能不会更改,因为这仅基于首先获取锁定的任何线程。 You want to join the thread after you have kicked off all of the threads. What your code currently does is starts a thread, then joins, then starts the next ... -
我想你要在群集中这样做,而不是在同一台机器上的多个线程中,除非你有一台带有多个网络接口卡(NIC)的机器。 你的瓶颈不是核心,而是你的网卡。 您的NIC仍将按顺序清空其缓冲区。 我建议你拥有尽可能多的机器集群。 在每台机器上,有一对线程(只是为了确保NIC的缓冲区保持满)。 不要打扰同步群集以同时发送请求,因为往返时间(RTT)将花费太长时间,它将使您的负载测试无效。 只需让每个Thread锤掉......从统计上讲,只要你的集群足够大,你就必须同时获得几个POST请求。 Id say you would ...