Sha256: da95bd917758badfde127bc035142db2d52cc3772236a1abe8c6f08a7968ba9f

Contents?: true

Size: 597 Bytes

Versions: 16

Compression:

Stored size: 597 Bytes

Contents

require 'httpclient'
require 'json'
require 'nokogiri'
require 'open-uri'


def request_json_parse(url)

    client=HTTPClient.new()
    response=client.get(url)

    if response.status==200
        return JSON.parse(response.body),response.status
    end

    return nil,response.status
 end


 def request_html_parse(url,opt)

    charset=nil
    status=[]
    response=URI.open(url,opt) do |f|
        charset=f.charset
        status=f.status
        f.read
    end

    if status[0]=="200"
        return Nokogiri::HTML.parse(response,nil,charset),status
    end

    return nil,status
 end
 

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
video_chat_get-0.3.6.10 lib/requests/request.rb
video_chat_get-0.3.6.9 lib/requests/request.rb
video_chat_get-0.3.6.8 lib/requests/request.rb
video_chat_get-0.3.6.5 lib/requests/request.rb
video_chat_get-0.3.6.4 lib/requests/request.rb
video_chat_get-0.3.6.3 lib/requests/request.rb
video_chat_get-0.3.6.2 lib/requests/request.rb
video_chat_get-0.3.6.1 lib/requests/request.rb
video_chat_get-0.2.6.1 lib/requests/request.rb
video_chat_get-0.2.6 lib/requests/request.rb
video_chat_get-0.2.3 lib/requests/request.rb
video_chat_get-0.2.2 lib/requests/request.rb
video_chat_get-0.2.1 lib/requests/request.rb
video_chat_get-0.2.0 lib/requests/request.rb
video_chat_get-0.1.9 lib/requests/request.rb
video_chat_get-0.1.6 lib/requests/request.rb