473,385 Members | 1,720 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,385 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 4644
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
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.