get

How to set timeout for http.Get() requests in Golang?

强颜欢笑 提交于 2019-11-28 13:34:17
问题 I'm making a URL fetcher in Go and have a list of URLs to fetch. I send http.Get() requests to each URL and obtain their response. resp,fetch_err := http.Get(url) How can I set a custom timeout for each Get request? (The default time is very long and that makes my fetcher really slow.) I want my fetcher to have a timeout of around 40-45 seconds after which it should return "request timed out" and move on to the next URL. How can I achieve this? 回答1: Apparently in Go 1.3 http.Client has

GET Request from PHP using file_get_contents with parameters

核能气质少年 提交于 2019-11-28 13:23:53
I want to send a GET request to an external site, but also want to send some parameters for example i've to send a get request to example.com i want to execute www.example.com/send.php?uid=1&pwd=2&msg=3&phone=3&provider=xyz My code is : $getdata = http_build_query( array( 'uid' => '1', 'pwd' => '2', 'msg'=>'3', 'phone'=>'9999', 'provider'=>'xyz' ) ); $opts = array('http' => array( 'method' => 'GET', 'content' => $getdata ) ); $context = stream_context_create($opts); $result = file_get_contents('http://example.com/send.php', false, $context); I get a server error . The content option is used

SSL Error on Python GET Request

跟風遠走 提交于 2019-11-28 13:21:09
问题 I am trying to do a simple GET request to this url: link Here's the basic python code which I already use for other urls and works. url = 'http://www.bbvafrances.com.ar/francesGo2-Portal/institucional/busqueda.do?m=&page=1' r = requests.get(url) print r.text The thing is that with this particular url I get an SSL error: Traceback (most recent call last): File "frances.py", line 134, in <module> r = requests.get(url,verify=False) File "/usr/local/lib/python2.7/dist-packages/requests/api.py",

How I can know the Domain for an IP by PHP?

本秂侑毒 提交于 2019-11-28 13:01:13
How I can know the Domain for an IP by PHP? I have used this code <?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); echo $hostname; ?> But it doesn't work correctly. For example: gethostbyaddr(62.75.138.253); domain name is earthwar.de but the correctly answer is german-proxy.de Please help. A single IP address can host a potentially unlimited number of domains. Domains returned by gethostbyaddr will give the domain name(s) from the PTR DNS records for that IP. A reverse DNS record (PTR) maps IP addresses to one or more domain names. One such company that provides intelligence as far

How to use $_GET?

社会主义新天地 提交于 2019-11-28 12:59:59
I have the following login script, where i do use sessions. <?php session_start(); if(isset($_SESSION['logged_in'])){ $id = $_SESSION['id']; header("Location: start.php?id=$id"); exit(); } if(isset($_POST['submit'])){ $x1 = $_POST['x1']; $x2 = $_POST['x2']; ... $query = $db->query("SELECT * FROM table WHERE x1='".$x1."' AND x2='".$x2."'"); if($query->num_rows === 1){ $row = $query->fetch_object(); $id = $row->id; $_SESSION['logged_in'] = true; $_SESSION['id'] = $id; header("Location: start.php?id=$id"); 3more queries exit(); start.php will be just: <?php echo $_GET['id']; ?> I thought $_GET[

Get pixel colors of tkinter canvas

不羁的心 提交于 2019-11-28 12:48:30
I'd like to be able to create and interact with a Tkinter Canvas and, at any time, be able to iterate over each of its pixels and get their RGB values. Setting pixel by pixel is not necessary, just getting. However, methods analogous to Canvas's create_polygon(), create_line(), create_text(), and create_oval() must be available as well for interacting with the image overall. There are a number of restraints: Must work with Python 3 Must work with Linux, Mac, and Windows Must work with libraries that come with Python (no downloads) The second restraint is mainly the reason I've posted this

Access GET variables with PHP + .htaccess

本秂侑毒 提交于 2019-11-28 12:44:51
I'm developing a website using PHP. My .htaccess has this rewrite rule: RewriteEngine On RewriteRule ^book/([^/]*)\.html$ book.php?title=$1 [L] So the URL that looked like: www.example.com/book.php?title=title-of-the-book turns into www.example.com/book/title-of-the-book.html In a specific case, from another page in the site, I want to link to pages like this: www.example.com/book.php?title=title-of-the-book?myfield=1 that then turns into www.example.com/book/title-of-the-book.html?myfield=1.html Being ther, I cannot acces the GET variables using the usual PHP way $variable = $_GET['myfield']

How to get the URL of a xmlhttp request (AJAX)

[亡魂溺海] 提交于 2019-11-28 12:38:45
问题 On w3schools.com(url) there is an example of how to do an AJAX call with plain Javascript. If you look at the example you will see the call is triggered by a button: <button type="button" onclick="loadXMLDoc()">Change Content</button> This is the function: function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp

Get result from php file without usig jquery

社会主义新天地 提交于 2019-11-28 12:33:39
问题 Is this possible to get result from a php file without using jQuery ? i haven't permission to use Jquery and any other javaScript platform. 回答1: Here is an example: function C_xmlObject() { var xml = null; try { xml = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { try { xml = new ActiveXObject("MSXML2.XMLHTTP"); } catch(e) { try { xml = new XMLHttpRequest(); } catch(e) { } } } return xml; } function C_ajax(daten, url) { var xml = C_xmlObject(); if(xml !== null) { xml.open('POST', url,

How to get the content of a remote page with JavaScript?

丶灬走出姿态 提交于 2019-11-28 12:25:16
I have a URL of a remote page from a different domain which I have to download, parse, and update DOM of the current page. I've found examples of doing this using new ActiveXObject("Msxml2.XMLHTTP") , but that's limited to IE, I guess, and using new java.net.URL , but I don't want to use Java. Are there any alternatives? Same domain policy is going to get you. 1) Proxy through your server. browser->your server->their server->your server->browser. 2) Use flash or silverlight. The 3rd party has to give you access. The bridge between javascript and flash isn't great for large amounts of data and