473,379 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Net::HTTP URI.parse

HI All,

i am new to ROR

i am writing Ruby code for calling API blogs

i have written ruby code for

creating a attachment xml by
Expand|Select|Wrap|Line Numbers
  1. require 'net/http'
  2. require 'uri'
  3.  
  4. url = URI.parse('https://localhost:3000/api/attachment/create.xml')
  5. req = Net::HTTP::Post.new(url.path)
  6. req.basic_auth 'a', 'a'
  7.  
  8. res = Net::HTTP.new(url.host, url.port).start {|http|
  9. http.request(req)}
  10.  
  11. case res
  12.   when Net::HTTPSuccess, Net::HTTPRedirection
  13.     puts res.body
  14.   else
  15.     res.error!
  16. end
  17.  
Actually this works fine wth http protocol,

My site is hosted in https protocol, can https protocol can be used in
the below format. if i try to convert this kind of URL i get a error
as

SocketError: getaddrinfo: Temporary failure in name resolution

plz help me in this
Jan 8 '11 #1
1 4642
numberwhun
3,509 Expert Mod 2GB
To parse an HTTPS connection, you are going to want to use:

Expand|Select|Wrap|Line Numbers
  1. require "net/https"
  2.  
There is an example on this cheat sheet page.

There is also another example .

Regards,

Jeff
Jan 17 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Kevin Kenny | last post by:
Dear All, I have a date time validation method thus: public static bool IsDate(string date, System.IFormatProvider provider) { try { DateTime.Parse(date, provider) return true; } catch...
3
by: thomson | last post by:
Hi all, please help me out "IF 25000 users request a yahoo page, will 25000 sockets will be created" For the Server to know which client has requested what there has to be a socket with the...
4
by: skOOb33 | last post by:
I am suspicious of the websites that the people I live with are using my computer for. Instead of buying software or downloading something visible to other users, I am wanting to create a vb...
2
by: PJ6 | last post by:
I can probably code this up manually myself but I'd prefer to use a built-in method that I'm sure exists... I have a message box client-side control (thanks, Steve Orr) that uses the JavaScript...
0
by: Divyakumar Jain,SAP Netweaver consultant | last post by:
Hi all, I have created an web service on SAP system. I have created a .net client using Micrsoft Visual Studio 2003 and .net frame work 2.0. in Visual Basic. In that .net client i have created...
0
by: Friso Wiskerke | last post by:
Hi all, Instead of placing the Javascript in an page we've put the script in a separate .js file and reference it from the page where it's being used using a <script language="js"...
1
by: John Braham | last post by:
I have a slight wall headbutter which I'm hoping someone will have an idea for (I'd be very grateful!). Basically I'm trying to make a form post to an asp page programatically from within VB.NET...
1
by: Morgan Cheng | last post by:
If a web server HTTP response is in chunked encoding, CLR client invocation on HttpWebResponse.Close will not return until the whole page is downloaded. If the page is huge, it looks the thread is...
0
by: | last post by:
I regularly scrape content from sites that require cookie information for auth. When I am on a dev machine using VS.NET and test my scraping tools, the returned content indicates that the webpage...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.