The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 19, 2019, 01:47:16 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Need help with a web request / URL problem  (Read 3100 times)
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« on: June 13, 2008, 01:00:27 PM »

Hey all -

A little background and then on to the problem: phpMyIDE has 2 types of requests that can be thrown from the command prompt - short and long. A short one is something simple like "show tables" or "use mydb" - essentially, the ajax request goes up to the server, gets the entire response and returns it in one big block. A long request is more like "select * from atable" because I A) have no idea how long it might take to execute the command and B) have no idea how big the response might be. So what happens is the IDE fires off a web request to itself to start processing the long request, putting responses into a table (long_responses) that are then picked up by the client at it's own pace. This decoupling of the speed of response at the server and the client's ability to retrieve data is part of what makes the command prompt work well, regardless of the length of the response.

But on to the problem: Dink let me work with his instance of phpMyIDE to see why long commands don't come back. Well what happens is the webRequest is thrown and the response is that "You are not authorized to access this page, or your browser doesn't know how to push authorization" - of course... when you go to browse Dink's phpMyIDE you have to enter a username and password.

So finally, my question: How do I send an authorization with a web request? I looked at the Authentication: header for a web request, but can't seem to get it right... I also can't tell if I will ALWAYS get a 401 and then need to respond with authentication or something... does anyone have any experience with this?

BTW: I can't use file_get_contents('username:node@domain.com:password') because of the way the apache-style multi threading works... I have to throw a raw request with webRequest. Thanks!
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #1 on: June 13, 2008, 03:38:30 PM »

i could tell you how to do it in ASP...  ROFLMAO
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #2 on: June 13, 2008, 03:56:20 PM »

Wanker. Some help you are  ROFLMAO
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: June 13, 2008, 08:56:21 PM »

TheDarkness is TheMAN.

Sees this thread, IMs me to get more data, fucking honks the answer out without breaking a sweat.

The answer: webRequest2 needed the ability to send simple authentication data in the header, the program line (which will be in the next version of webRequest2 as well as phpMyIDE)

$header[] = 'Authorization: Basic ' . base64_encode("$userName:$password");


... well, close to that... you get the idea.

Thanks TD, very much.
« Last Edit: June 13, 2008, 08:58:11 PM by perkiset » Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
thedarkness
Lifer
*****
Offline Offline

Posts: 585



View Profile
« Reply #4 on: June 14, 2008, 05:42:58 PM »

Any time bro.
Logged

"I want to be the guy my dog thinks I am."
 - Unknown
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!