当前位置: 首页>>代码示例>>PHP>>正文


PHP HttpRequest::getError方法代码示例

本文整理汇总了PHP中HttpRequest::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpRequest::getError方法的具体用法?PHP HttpRequest::getError怎么用?PHP HttpRequest::getError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpRequest的用法示例。


在下文中一共展示了HttpRequest::getError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: HttpRequest

 function __construct($args)
 {
     $url = $this->formatUrl($args);
     echo "Getting {$url}\n";
     $r = new HttpRequest("get", $url);
     if ($r->getError()) {
         echo $r->getError();
     } else {
         $this->response = json_decode($r->getResponse(), true);
     }
 }
开发者ID:hay,项目名称:hay,代码行数:11,代码来源:dlcomcatcm.php

示例2: getUserMeta

 function getUserMeta()
 {
     $url = "http://api.twitter.com/1/users/show.json?screen_name=" . $this->user;
     $r = new HttpRequest("get", $url);
     if ($r->getError()) {
         $this->error("Could not get user information");
     } else {
         return json_decode($r->getResponse(), true);
     }
 }
开发者ID:hay,项目名称:wherewereyou,代码行数:10,代码来源:class-tweets.php

示例3: request

 protected function request($url)
 {
     // Check if this is an url or a filename
     if (substr($url, 0, 4) != "http") {
         // File
         return json_decode(file_get_contents($url), true);
     } else {
         $r = new HttpRequest("get", $url);
         if ($r->getError()) {
             return false;
         } else {
             return json_decode($r->getResponse(), true);
         }
     }
 }
开发者ID:hay,项目名称:wherewereyou,代码行数:15,代码来源:class-api-call.php

示例4: t_estXpathSetup

 public function t_estXpathSetup()
 {
     return;
     $datPath = implode('/', [PATH_TEST, 'dat', 'ContentExtractor']);
     //		$res = exec(sprintf('rm -rf %s/*', $datPath), $out);
     foreach ($this->getData() as $name => $testData) {
         $httpRequest = new HttpRequest($testData->url);
         $ret = $httpRequest->exec();
         if (!$ret) {
             d($httpRequest->getError());
             d($httpRequest->getInfo());
         }
         $this->assertEquals(true, $ret);
         file_put_contents($datPath . '/' . $name, $httpRequest->getResponse());
     }
 }
开发者ID:gammodoking,项目名称:kindle.server,代码行数:16,代码来源:ContentExtractorTest.php

示例5: die

require 'class-http-request.php';
// Get query or die
$query = $argv[1];
if (empty($query)) {
    die("No query given\n");
}
echo "Downloading tweets with query '{$query}'\n";
$page = 1;
$baseUrl = "http://search.twitter.com/search.json?q={$query}&rpp=100";
$tweets = array();
do {
    $url = $baseUrl . "&page={$page}";
    echo "REQUEST: {$url} \n";
    $r = new HttpRequest("GET", $url);
    if ($r->getError()) {
        echo "HTTP ERROR: " . $r->getError();
        break;
    } else {
        $json = json_decode($r->getResponse(), true);
        // No more tweets?
        $length = count($json['results']);
        if ($length < 1) {
            echo "NO MORE TWEETS\n";
            break;
        }
        $tweets = array_merge($tweets, $json['results']);
        print_r($tweets);
        file_put_contents("{$query}.json", json_encode($tweets));
        $page++;
    }
开发者ID:hay,项目名称:hay,代码行数:30,代码来源:twitterdl.php

示例6: Query

<?php

$start = $_GET['start'];
$token = $_GET['tok'];
require_once 'query.php';
$q = new Query();
$sql = "select distinct USERID from session where ACCESS_TOKEN={$token}";
$val = $q->getallentires($sql);
//var_dump($val);
//$v=$val['USERID'];
foreach ($val as $value) {
    # code...
    $v = $value['USERID'];
    //echo $v;
}
error_reporting(E_ALL);
ini_set("display_errors", "1");
require_once 'Http2.php';
$r = new HttpRequest("post", "http://52.76.14.6:8080/BaatnaServer/rest/wish/get?start={$start}&count=15&type=1&another_user=6", array("access_token" => $token));
if ($r->getError()) {
    echo "sorry, an error occured";
} else {
    // parse json
    //var_dump($r->getResponse());
    $js = json_decode($r->getResponse());
    $obj = $js->{"response"};
    $obj2 = $obj->wishes;
    echo json_encode($obj2);
}
开发者ID:app-ad,项目名称:Baatna-web,代码行数:29,代码来源:httprequestoffers.php

示例7: HttpRequest

<?php

//echo $access_token;
//$access_token="68474014519902762";
error_reporting(E_ALL);
ini_set("display_errors", "1");
require_once 'Http2.php';
$r = new HttpRequest("post", "http://52.76.14.6:8080/BaatnaServer/rest/messaging/get", array("access_token" => $access_token, "client_id" => "bt_android_client", "app_type" => "bt_android"));
if ($r->hasError()) {
    echo $r->getError();
    echo "sorry, an error occured";
} else {
    // parse json
    $js = json_decode($r->getResponse());
    $response = $js->{"response"};
    $msg = $response->{"messages"};
    $nam = array();
    foreach ($msg as $m) {
        $obj = $m->{"message"};
        $wish = $obj->wish;
        $user = $obj->user;
        $u2 = $user->user;
        $name = $u2->user_name;
        $id = $u2->user_id;
        array_push($nam, array('name' => $name, 'id' => $id));
        // echo $name;
    }
    include 'messview.php';
}
开发者ID:app-ad,项目名称:Baatna-web,代码行数:29,代码来源:messget.php


注:本文中的HttpRequest::getError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。