不熟悉Curl并且是一个PHP新手,有没有办法使用代码来查看最终使用curl_exec发送的请求?拥有一个真实的例子真的会有所帮助.事实上,我对简单的字段很好 – 每个字段都有一个单独的边界/部分.这是JPEG图像编码对我来说是棘手的.我可以设置一个PHP环境并以某种方式调试它?我推断Curl是一种Web客户端,即它在没有用户界面的情况下完成了Web浏览器的大部分功能.
<?PHP function AddPhoto( $account,$password,$pubID,$photoID,$owner,$pubDate,$attribution,$caption,$keywords,$photopath ) { // set up the arguments of the multipart form data $args = array( 'Method' => 'AddPhoto','Account' => 'Test','Password' => 'pw','PubID' => 'WOR/1002','PhotoID' => '12345','Owner' => 'me','PubDate' => '2015-07-01','Attribution' => '','Caption' => 'the front door','Keywords' => 'Pub','Photo' => new Curlfile( $photopath,// path to the file 'image/jpeg',// MIME type of the file 'image' // file name (not used) ) ); // create a curl request object $ch = curl_init(); curl_setopt ($ch,CURLOPT_URL,'http://dev.camrapubs.org.uk/simon/PubDatabase/API2.PHP'); curl_setopt( $ch,CURLOPT_POST,1 ); // use the POST method curl_setopt( $ch,CURLOPT_POSTFIELDS,$args ); // supply the arguments for the POST curl_setopt( $ch,CURLOPT_RETURNTRANSFER,1 ); // ensure curl_exec returns the result rather than echoing it // make the call and get the result return curl_exec($ch); } $result = AddPhoto( ‘xx',‘xx','WOR/1002','12345','me','2015-07-01','copyleft','The front door','Pub','sample.jpg' ); echo 'result = ',$result,PHP_Eol;?>解决方法 抢,
也许你应该看看这个?
Php – Debugging Curl
祝成功:-)
总结以上是内存溢出为你收集整理的获取Curl生成的POST流的示例,以帮助移植到C#全部内容,希望文章能够帮你解决获取Curl生成的POST流的示例,以帮助移植到C#所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)