首页 \ 问答 \ 使用curl对bitbucket-api进行GET请求(doing a GET request to bitbucket-api using curl)

使用curl对bitbucket-api进行GET请求(doing a GET request to bitbucket-api using curl)

我正在尝试做一个简单的GET请求并返回屏幕上的响应。 当我加载页面时,我得到一个空白页面。 我觉得我很近,但我不知道我哪里出错了。

我假设如果它成功运作我应该得到某种回应。

    $url='https://api.bitbucket.org/1.0/user/';

    $curl = curl_init();

    curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ); 
    curl_setopt($curl, CURLOPT_USERPWD, "username:password");
    curl_setopt($curl, CURLOPT_HEADER, true); 
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_URL, $url);

    curl_exec($curl);

I'm trying to do a simple GET request and return whatever the response is too the screen. When i load the page i get a blank page. I feel like im close, but im not sure where i am going wrong.

I'm assuming that i should get some kind of response if it worked succesfully.

    $url='https://api.bitbucket.org/1.0/user/';

    $curl = curl_init();

    curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ); 
    curl_setopt($curl, CURLOPT_USERPWD, "username:password");
    curl_setopt($curl, CURLOPT_HEADER, true); 
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_URL, $url);

    curl_exec($curl);

原文:https://stackoverflow.com/questions/15011169
更新时间:2023-05-05 15:05

最满意答案

由于标准函数.slideDown和.slideUp将垂直执行效果,因此您必须使用.animate,如下所示:

$("#"+objCurrentDiv).animate({'width':'0%','display':'none'},"slow",function(){
  $("#"+objNewDiv).animate({'width':'100%','display':'block'},"slow");
});

Since the standard function .slideDown and .slideUp will do the effect vertically, you have to use .animate like this:

$("#"+objCurrentDiv).animate({'width':'0%','display':'none'},"slow",function(){
  $("#"+objNewDiv).animate({'width':'100%','display':'block'},"slow");
});

相关问答

更多
  • 问题是:你的代码看起来像 - 将元素html改为'Successfuly Changed' - 然后fadOut()用1000直接改为'New Name'你可以看到fadeOut()然后fadeIn() ..为避免这种情况,您需要使用fadeOut()回调函数 $('#position-name').html('Successfuly Changed').fadeOut(1000 ,function(){ $(this).html('New Name').fadeIn(); });