Login   Register  
PHP Classes
elePHPant
Icontem

File: index2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Abraham Cruz Sustaita  >  Sit\Http  >  index2.php  >  Download  
File: index2.php
Role: Example script
Content type: text/plain
Description: Another example
Class: Sit\Http
Send HTTP requests using the Curl extension
Author: By
Last change: Fixing error when getting xml information
Date: 1 year ago
Size: 2,228 bytes
 

Contents

Class file image Download
<?php
include_once "Sit/Http.php";

$curl = new Sit_Http("http://ycpi.api.flickr.com/services/rest/?method=flickr.test.echo&name=value");
$result $curl->execute();

print_r($result);
print_r(" \n\n \n\nRaw result: \n\n");
print_r($curl->getResult(true));

/*
Array
(
    [result] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [stat] => fail
                )

            [err] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [code] => 100
                            [msg] => Invalid API Key (Key has invalid format)
                        )

                )

        )

    [headers] => Array
        (
            [url] => http://ycpi.api.flickr.com/services/rest/?method=flickr.test.echo&name=value
            [content_type] => text/xml; charset=utf-8
            [http_code] => 200
            [header_size] => 694
            [request_size] => 107
            [filetime] => -1
            [ssl_verify_result] => 0
            [redirect_count] => 0
            [total_time] => 0.154846
            [namelookup_time] => 0.001964
            [connect_time] => 0.004922
            [pretransfer_time] => 0.004958
            [size_upload] => 0
            [size_download] => 132
            [speed_download] => 852
            [speed_upload] => 0
            [download_content_length] => 132
            [upload_content_length] => 0
            [starttransfer_time] => 0.154811
            [redirect_time] => 0
            [certinfo] => Array
                (
                )

            [primary_ip] => 98.136.145.152
            [primary_port] => 80
            [local_ip] => 10.190.221.123
            [local_port] => 46240
            [redirect_url] => 
            [request_header] => GET /services/rest/?method=flickr.test.echo&name=value HTTP/1.1
Host: ycpi.api.flickr.com
Accept: */ 
*


        )

    [
request] => 
)
 

 

Raw result

<?
xml version="1.0" encoding="utf-8" ?>
<rsp stat="fail">
    <err code="100" msg="Invalid API Key (Key has invalid format)" />
</rsp>