Re: [PHP] Google Chrome
Shawn McKenzie wrote: Per Jessen wrote: Stut wrote: On 2 Sep 2008, at 20:23, Diogo Neves wrote: Now is the time ;) Indeed: http://www.google.com/chrome But only for Windows for now :( I guess we'll have to wait a little longer then ... /Per Jessen, Zürich Will somebody volunteer to test on Wine or Mono? -Shawn Tried on Wine (version 0.9.60 on OpenSuse) and I could even get the downloader to start. To be fair, I've never really got anything to work on Wine... -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Google Chrome
Hi, There's an option for pre-buffering things, I believe. Where? -- Richard Heyes HTML5 Graphing for IE7, FF, Opera and Safari: http://www.phpguru.org/RGraph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Google Chrome
I uninstalled it precisely beacause of this behaviour. The disk was running crazy every time chrome was started. And I don't know how to do lsof | grep chrome on Windows to see what's going on. LSOF for winblows: http://download.sysinternals.com/Files/ProcessMonitor.zip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Google Chrome
Robert Cummings schreef: On Fri, 2008-09-05 at 03:15 +0200, Jochem Maas wrote: Bastien Koert schreef: On Thu, Sep 4, 2008 at 5:22 PM, Jochem Maas [EMAIL PROTECTED] wrote: Bastien Koert schreef: On Thu, Sep 4, 2008 at 4:31 PM, Dan Shirah [EMAIL PROTECTED] wrote: Yippie, Chrome already exploited for DoS attacks? http://blogs.zdnet.com/security/?p=1847tag=nl.e539 Its not a DoS, its just a browser crash so forcing a browser to crash is not 'Denial of Service'? I think your confused with DDoS DDoS is a Distributed Denial of Service attack where a server is attacked via multiple computers (like a bot net) at the same time AFAIK no shit. so if you drop the 'Distributed' you get 'Denial of Service'. DoS is rather general, code that keeps crashing your browser on purpose is denying you the service it provides (viewing webpages). rather like someone running off with your girlfriend ... you get denied service. I thought Chrome was set up so if your current page caused a crash other loaded pages didn't crash also. In which case DoS doesn't apply if only the requested page crashes since you're still getting service. yes, and somebody already showed how to crash the whole damn app. type 'evil:%', for example, into the addressbar IIRC :-D Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Google Chrome
-Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2008 6:53 AM To: Robert Cummings Cc: Bastien Koert; Dan Shirah; [EMAIL PROTECTED]; List_PHP_General Subject: Re: [PHP] Google Chrome Robert Cummings schreef: On Fri, 2008-09-05 at 03:15 +0200, Jochem Maas wrote: Bastien Koert schreef: On Thu, Sep 4, 2008 at 5:22 PM, Jochem Maas [EMAIL PROTECTED] wrote: Bastien Koert schreef: On Thu, Sep 4, 2008 at 4:31 PM, Dan Shirah [EMAIL PROTECTED] wrote: Yippie, Chrome already exploited for DoS attacks? http://blogs.zdnet.com/security/?p=1847tag=nl.e539 Its not a DoS, its just a browser crash so forcing a browser to crash is not 'Denial of Service'? I think your confused with DDoS DDoS is a Distributed Denial of Service attack where a server is attacked via multiple computers (like a bot net) at the same time AFAIK no shit. so if you drop the 'Distributed' you get 'Denial of Service'. DoS is rather general, code that keeps crashing your browser on purpose is denying you the service it provides (viewing webpages). rather like someone running off with your girlfriend ... you get denied service. I thought Chrome was set up so if your current page caused a crash other loaded pages didn't crash also. In which case DoS doesn't apply if only the requested page crashes since you're still getting service. yes, and somebody already showed how to crash the whole damn app. type 'evil:%', for example, into the addressbar IIRC Yep, that'll do it. As soon as you type the %, it crashes. Anything followed by :% seems to do it. Also FWIW, I've crashed it with 5 tabs open when I tried to close one of the tabs. Clicking the option to restart Chrome brought it back up with all 5 tabs. Again, when I tried to close one, it crashed and reinstated all 5 upon restart... ad nauseum. Maybe I'm picky... but if a newly-released beta program crashes in the first minute or two that I'm playing with, it proobably wasn't ready for beta in the first place. My 2c. Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Google Chrome
On Thu, Sep 4, 2008 at 9:15 PM, Jochem Maas [EMAIL PROTECTED] wrote: rather like someone running off with your girlfriend ... you get denied service. Burn of the week! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header() - POST
Hi everyone, I am trying to figure out how to build a post string, and then user header to post it. I've done some research and I am not getting very far. Basically what I'm doing is taking POST items, then validating them, scrubbing them, and rebuidling the post string and trying to resubmitt it using headers(). I'm getting this error: ErrorCGI ErrorThe specified CGI application misbehaved by not returning a complete set of HTTP headers. Here is my header code, and the post string below it. I don't have any idea what I'm missing or doing wrong. Any help is appreciated! header( POST /v2/order_submitorder.php HTTP/1.0 ); header( Host: new.vtusa.com ); header( Content-Type: application/x-www-form-urlencoded ); header( Content-Length: . strlen( $post_string ) ); header( $post_string ); Quote Management System v3.00.0903PCompanyName=PFirstName=DanPLastName=JosephPAddress1=123 StreetPAddress2=PCity=NorthvillePState=MIPZipCode=48167PEmailAddress= [EMAIL PROTECTED]PPhone=2485551212PCellPhone=2485521212PFax=OFirstName=JackOLastName=MotherOAddress1=456 AvenueOAddress2=OCity=OmahaOState=NeOZipCode=68101OPhone=24888OCellPhone=248788DFirstName=YohanDLastName=JacquesDAddress1=789 BoulevardDAddress2=DCity=NorthvilleDState=MiDZipCode=48167DPhone=586777DCellPhone=586677VehicleVIN=1234567890ABCDEFGVehicleYear=2007VehicleMake=HondaVehicleModel=CivicVehicleColor=GreyVehicleMiles=234234ordersubmit=Submit OrderUserID=90QuoteID=427 -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
Re: [PHP] Header() - POST
!-- SNIP -- scrubbing them, and rebuidling the post string and trying to resubmitt it using headers(). I'm getting this error: Why do you want to re-submit it? Why not just parse it in the same page? If not that, then use sessions and set the information, do a meta-refresh to redirect to the processing page, then use the processing page to pull the session information and make sure it came from the correct page. HTH, Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() - POST
On Fri, Sep 5, 2008 at 11:48 AM, Wolf [EMAIL PROTECTED] wrote: !-- SNIP -- scrubbing them, and rebuidling the post string and trying to resubmitt it using headers(). I'm getting this error: Why do you want to re-submit it? Why not just parse it in the same page? If not that, then use sessions and set the information, do a meta-refresh to redirect to the processing page, then use the processing page to pull the session information and make sure it came from the correct page. HTH, Wolf Hmm good question on why I am re-submitting to a new page. Honestly, I have no good answer for that other than I have been rushing this part of the system for two days to get it done. I didn't think of Sessions, that's actually not a bad idea at all. I am going to re-think the re-submitting thing, and if I stick with it, I'll give our session idea a shot. Thanks for the idea! -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
RE: [PHP] Header() - POST
-Original Message- From: Dan Joseph [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2008 10:59 AM To: PHP General Subject: Re: [PHP] Header() - POST On Fri, Sep 5, 2008 at 11:48 AM, Wolf [EMAIL PROTECTED] wrote: !-- SNIP -- scrubbing them, and rebuidling the post string and trying to resubmitt it using headers(). I'm getting this error: Why do you want to re-submit it? Why not just parse it in the same page? If not that, then use sessions and set the information, do a meta- refresh to redirect to the processing page, then use the processing page to pull the session information and make sure it came from the correct page. HTH, Wolf Hmm good question on why I am re-submitting to a new page. Honestly, I have no good answer for that other than I have been rushing this part of the system for two days to get it done. I didn't think of Sessions, that's actually not a bad idea at all. I am going to re-think the re-submitting thing, and if I stick with it, I'll give our session idea a shot. I think what Wolf was getting at is... if the data you're scrubbing is being re-submitted to the same page, why re-submit it at all? Why not just scrub it and then do whatever it is you want to do with it instead of putting an extra step in-between? I see your model like this: 1.) Get POST data 2.) Scrub POST data 3.) Re-submit POST data 4.) Deal with POST data Whereas I'm getting at this: 1.) Get POST data 2.) Scrub POST data 3.) Deal with POST data Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() - POST
On 5 Sep 2008, at 16:43, Dan Joseph wrote: I am trying to figure out how to build a post string, and then user header to post it. I've done some research and I am not getting very far. Basically what I'm doing is taking POST items, then validating them, scrubbing them, and rebuidling the post string and trying to resubmitt it using headers(). I'm getting this error: ErrorCGI ErrorThe specified CGI application misbehaved by not returning a complete set of HTTP headers. Here is my header code, and the post string below it. I don't have any idea what I'm missing or doing wrong. Any help is appreciated! header( POST /v2/order_submitorder.php HTTP/1.0 ); header( Host: new.vtusa.com ); header( Content-Type: application/x-www-form-urlencoded ); header( Content-Length: . strlen( $post_string ) ); header( $post_string ); You're trying to post to the browser which won't know how to handle it. The header() function is modifying the response headers that are being sent back to the browser, they do not create a new request. If you want to do a new request I suggest looking at curl. If you actually want the browser to make the new request the only way is to return a hidden form and auto-submit it with JS. However, as someone else pointed out if that second request is coming back to the same server there probably isn't any need for a second request at all. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() - POST
On Fri, Sep 5, 2008 at 12:11 PM, Boyd, Todd M. [EMAIL PROTECTED] wrote: -Original Message- From: Dan Joseph [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2008 10:59 AM To: PHP General Subject: Re: [PHP] Header() - POST On Fri, Sep 5, 2008 at 11:48 AM, Wolf [EMAIL PROTECTED] wrote: !-- SNIP -- scrubbing them, and rebuidling the post string and trying to resubmitt it using headers(). I'm getting this error: Why do you want to re-submit it? Why not just parse it in the same page? If not that, then use sessions and set the information, do a meta- refresh to redirect to the processing page, then use the processing page to pull the session information and make sure it came from the correct page. HTH, Wolf Hmm good question on why I am re-submitting to a new page. Honestly, I have no good answer for that other than I have been rushing this part of the system for two days to get it done. I didn't think of Sessions, that's actually not a bad idea at all. I am going to re-think the re-submitting thing, and if I stick with it, I'll give our session idea a shot. I think what Wolf was getting at is... if the data you're scrubbing is being re-submitted to the same page, why re-submit it at all? Why not just scrub it and then do whatever it is you want to do with it instead of putting an extra step in-between? I see your model like this: 1.) Get POST data 2.) Scrub POST data 3.) Re-submit POST data 4.) Deal with POST data Whereas I'm getting at this: 1.) Get POST data 2.) Scrub POST data 3.) Deal with POST data Todd Boyd Web Programmer I'm actually not posting back to the same page, I was posting to a different one. Which still, when he mentioned it, it didn't make sense why I am doing that. I am in agreement with you and Wolf. I should just scrub it and deal with it, not re-submit it off to another place. -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
RE: [PHP] Header() - POST
-Original Message- From: Dan Joseph [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2008 11:16 AM To: php-general@lists.php.net Subject: Re: [PHP] Header() - POST On Fri, Sep 5, 2008 at 12:11 PM, Boyd, Todd M. [EMAIL PROTECTED] wrote: -Original Message- From: Dan Joseph [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2008 10:59 AM To: PHP General Subject: Re: [PHP] Header() - POST On Fri, Sep 5, 2008 at 11:48 AM, Wolf [EMAIL PROTECTED] wrote: !-- SNIP -- scrubbing them, and rebuidling the post string and trying to resubmitt it using headers(). I'm getting this error: Why do you want to re-submit it? Why not just parse it in the same page? If not that, then use sessions and set the information, do a meta- refresh to redirect to the processing page, then use the processing page to pull the session information and make sure it came from the correct page. HTH, Wolf Hmm good question on why I am re-submitting to a new page. Honestly, I have no good answer for that other than I have been rushing this part of the system for two days to get it done. I didn't think of Sessions, that's actually not a bad idea at all. I am going to re-think the re-submitting thing, and if I stick with it, I'll give our session idea a shot. I think what Wolf was getting at is... if the data you're scrubbing is being re-submitted to the same page, why re-submit it at all? Why not just scrub it and then do whatever it is you want to do with it instead of putting an extra step in-between? I see your model like this: 1.) Get POST data 2.) Scrub POST data 3.) Re-submit POST data 4.) Deal with POST data Whereas I'm getting at this: 1.) Get POST data 2.) Scrub POST data 3.) Deal with POST data Todd Boyd Web Programmer I'm actually not posting back to the same page, I was posting to a different one. Which still, when he mentioned it, it didn't make sense why I am doing that. I am in agreement with you and Wolf. I should just scrub it and deal with it, not re-submit it off to another place. On a side note... in the future, if you find that a particular process calls for POSTing to a different page, the cURL library (which I believe is now included with PHP by default in v5.x+) can accomplish a plethora of wonderful stuff that would ordinarily be handled by a browser (POSTing, basic HTTP authentication, SSL certs, etc.). Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() - POST
On Fri, Sep 5, 2008 at 9:20 AM, Boyd, Todd M. [EMAIL PROTECTED] wrote: On a side note... in the future, if you find that a particular process calls for POSTing to a different page, the cURL library (which I believe is now included with PHP by default in v5.x+) can accomplish a plethora of wonderful stuff that would ordinarily be handled by a browser (POSTing, basic HTTP authentication, SSL certs, etc.). correct: curl is king for that OP: sending POST to the browser doesn't do anything. POST is a request, not a response. if you want to re-post data you need to look at a client-side alternative using javascript (or applets - flash, java, etc) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() - POST
POST requests in Ajax (or without in js) is straight forward. On the iPod now but I'll POST an example later. Get it? Luke Slater Lead Developer NuVoo On 5 Sep 2008, at 18:14, mike [EMAIL PROTECTED] wrote: On Fri, Sep 5, 2008 at 9:20 AM, Boyd, Todd M. [EMAIL PROTECTED] wrote: On a side note... in the future, if you find that a particular process calls for POSTing to a different page, the cURL library (which I believe is now included with PHP by default in v5.x+) can accomplish a plethora of wonderful stuff that would ordinarily be handled by a browser (POSTing, basic HTTP authentication, SSL certs, etc.). correct: curl is king for that OP: sending POST to the browser doesn't do anything. POST is a request, not a response. if you want to re-post data you need to look at a client-side alternative using javascript (or applets - flash, java, etc) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending POST variables without html code
Hi, I need to create a cron job PHP script to access every day the information of a webpage that is out of my server. This webpage needs POST variables to display the information. How can i send this POST variables from my PHP script without having a html form, and receive the required information? Thanks, RB
Re: [PHP] Sending POST variables without html code
On Fri, 2008-09-05 at 11:40 -0600, R B wrote: Hi, I need to create a cron job PHP script to access every day the information of a webpage that is out of my server. This webpage needs POST variables to display the information. How can i send this POST variables from my PHP script without having a html form, and receive the required information? Make a socket connection or preferrably use CURL to do the low level stuff for you. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Google Chrome
Under the Options and Under the Hood there's an option called: Use DNS pre-fetching to improve page load performance I think that's what I was thinking of. That's probably not pre-fetching whole pages so much as just resolving DNS ahead of time. There still could be some pre-caching going on that you just can't control. Not sure. -TG - Original Message - From: Richard Heyes [EMAIL PROTECTED] To: TG [EMAIL PROTECTED] Cc: Ovidiu Rosoiu [EMAIL PROTECTED],php-general@lists.php.net Date: Fri, 5 Sep 2008 09:12:13 +0100 Subject: Re: [PHP] Google Chrome Hi, There's an option for pre-buffering things, I believe. Where? -- Richard Heyes HTML5 Graphing for IE7, FF, Opera and Safari: http://www.phpguru.org/RGraph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending username/password
Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. Thanks, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? In one word... CURL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html . Jay: How does the device ask for the username and password? Is it a form on the web page, a window from the browser, or what? -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html. Jay: How does the device ask for the username and password? Is it a form on the web page, a window from the browser, or what? -Stut Stut - Standard browser prompt. I'm usually pretty good with PHP stuff and I've bypassed normal forms many times before, but I've never tried to bypass the browser popup (.htaccess or similar, I presume?). Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
On Fri, 2008-09-05 at 21:07 +0100, Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html Yeah, that's it lol :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Wolf wrote: Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? In one word... CURL A couple of people have responded (to me; not the list) with that very same response. I've heard of it, but never used it before. Care to give me the 30 second rundown [I can read the site, sure, but it's probably easier if you explained it :) ]? Is it like a glorified socket connection or something? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Jay Moore wrote: Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html. Jay: How does the device ask for the username and password? Is it a form on the web page, a window from the browser, or what? -Stut Stut - Standard browser prompt. I'm usually pretty good with PHP stuff and I've bypassed normal forms many times before, but I've never tried to bypass the browser popup (.htaccess or similar, I presume?). The browser popup is caused by a requirement for HTTP authentication. Curl is your best bet for this. All you need to do is set the following option with the username and password... curl_setopt($curl_handle, CURLOPT_USERPWD, $username.':'.$password); ...for each request. If you don't have curl available then you can fall back on opening a socket and writing the HTTP request manually. If you need to do this lemme know - I have some code kicking around somewhere that does it. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Robert Cummings wrote: On Fri, 2008-09-05 at 21:07 +0100, Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html Yeah, that's it lol :) Cheers, Rob. FYI - Typing this response on my old 286 because Rob's original suggestion made my 37.612-core Core2Duo box (used for notepad and newsgroups only) explode. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
On Fri, 2008-09-05 at 21:24 +0100, Stut wrote: Jay Moore wrote: Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html. Jay: How does the device ask for the username and password? Is it a form on the web page, a window from the browser, or what? -Stut Stut - Standard browser prompt. I'm usually pretty good with PHP stuff and I've bypassed normal forms many times before, but I've never tried to bypass the browser popup (.htaccess or similar, I presume?). The browser popup is caused by a requirement for HTTP authentication. Curl is your best bet for this. All you need to do is set the following option with the username and password... curl_setopt($curl_handle, CURLOPT_USERPWD, $username.':'.$password); ...for each request. If you don't have curl available then you can fall back on opening a socket and writing the HTTP request manually. If you need to do this lemme know - I have some code kicking around somewhere that does it. Can also use file() or file_get_contents() if your PHP config enables allow_url_fopen Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
On Fri, 2008-09-05 at 15:26 -0500, Jay Moore wrote: Robert Cummings wrote: On Fri, 2008-09-05 at 21:07 +0100, Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html Yeah, that's it lol :) Cheers, Rob. FYI - Typing this response on my old 286 because Rob's original suggestion made my 37.612-core Core2Duo box (used for notepad and newsgroups only) explode. :) Sorry bout that. However, malformed URL bugs that cause your system to crash can't really be attributed to me ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Jay Moore wrote: Robert Cummings wrote: On Fri, 2008-09-05 at 21:07 +0100, Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html Yeah, that's it lol :) Cheers, Rob. FYI - Typing this response on my old 286 because Rob's original suggestion made my 37.612-core Core2Duo box (used for notepad and newsgroups only) explode. Jay That'll teach you to use Google Chrome. ;) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Jay Moore schreef: Wolf wrote: Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? In one word... CURL A couple of people have responded (to me; not the list) with that very same response. I've heard of it, but never used it before. Care to give me the 30 second rundown [I can read the site, sure, but it's probably easier if you explained it :) ]? Is it like a glorified socket connection or something? is it too much to ask to spend 30 seconds RTFM? http://php.net/curl (it's an extension based on libcurl if you care to google further) cURL = Client URL Libary ... read it really really slowly, then it may take 30 seconds. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
:) Sorry bout that. However, malformed URL bugs that cause your system to crash can't really be attributed to me ;) Cheers, Rob. The prompt that showed before my computer self-destructed referenced you specifically. Expect the invoice for my new quantum computer to come in the mail shortly. I trust you will remit payment promptly. I'd hate to have to get the internet police involved. I hear they're itchin' to taze you, bro. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
That'll teach you to use Google Chrome. ;) Pshaw. IE5 4 lyfe, yo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Robert Cummings wrote: On Fri, 2008-09-05 at 21:24 +0100, Stut wrote: Jay Moore wrote: Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html. Jay: How does the device ask for the username and password? Is it a form on the web page, a window from the browser, or what? -Stut Stut - Standard browser prompt. I'm usually pretty good with PHP stuff and I've bypassed normal forms many times before, but I've never tried to bypass the browser popup (.htaccess or similar, I presume?). The browser popup is caused by a requirement for HTTP authentication. Curl is your best bet for this. All you need to do is set the following option with the username and password... curl_setopt($curl_handle, CURLOPT_USERPWD, $username.':'.$password); ...for each request. If you don't have curl available then you can fall back on opening a socket and writing the HTTP request manually. If you need to do this lemme know - I have some code kicking around somewhere that does it. Can also use file() or file_get_contents() if your PHP config enables allow_url_fopen Quite correct, assuming it's a GET request that's needed. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using DOM textContent Property
Nathan, Thanks for the suggestion, but it's still not working for me. Here's my code: === $HTML = new DOMDocument(); @$HTML-loadHTML($text); $Elements = $HTML-getElementsByTagName(*); for ($X = 0; $X $Elements-length; $X++) { $Element = $Elements-item($X); if ($Element-tagName == a) { # SNIP - Do something with A tags here } else if ($Element instanceof DOMText) { echo $Element-nodeValue; exit; } } === This loop never executes the instanceof part of the code. If I add: } else if ($Element instanceof DOMNode) { echo foo!; exit; } Then it echos foo! as expected. It just seems that none of the nodes in the tree are DOMText nodes. In fact, get_class($Element) returns DOMElement for every node in the tree. Tim Gustafson SOE Webmaster UC Santa Cruz [EMAIL PROTECTED] 831-459-5354 From: Nathan Nobbe [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 03, 2008 11:55 AM To: Tim Gustafson Cc: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] Using DOM textContent Property On Wed, Sep 3, 2008 at 10:03 AM, Tim Gustafson [EMAIL PROTECTED] wrote: I think you might be better off using regexp on the text *before* sending it through the DOM parser. Send the user's text through a function that searches for URLs and email addresses, creating proper links as they're found, then use the output from that to move on to your DOM stuff. That way, you need not create new nodes in your nodelist. I think that's the way I'm going to have to go, but I was really hoping not to. Thanks for the suggestion! i think i have what youre looking for Tim, take a look at this script output [EMAIL PROTECTED] ~ $ php testDom.php IN: ?xml version=1.0 standalone=yes? !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/REC-html40/loose.dtd; htmlbodyTestbr/h2[EMAIL PROTECTED]a name=barstuff inside the link/aFoo/h2pcare/ppyoyser/p/body/html OUT: ?xml version=1.0 standalone=yes? !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/REC-html40/loose.dtd; htmlbodyTestbr/h2a href=mailto:[EMAIL PROTECTED][EMAIL PROTECTED]/aa name=barstuff inside the link/aFoo/h2pcare/ppyoyser/p/body/html and heres the code using the DOM extension you may have to tweak it to suit your needs, but currently i think it does the trick ;) ?php $doc = new DOMDocument(); $doc-loadHTML('htmlbodyTestbrh2[EMAIL PROTECTED]a name=barstuff inside the link/aFoo/h2pcare/ppyoyser/p/body/html'); echo 'IN:' . PHP_EOL . $doc-saveXML() . PHP_EOL; findTextNodes($doc-getElementsByTagName('*'), 'convertToLinkIfNecc'); echo 'OUT: ' . PHP_EOL . $doc-saveXML() . PHP_EOL; /** * run through a DOMNodeList, looking for text nodes. apply a callback to * all such text nodes that are encountered */ function findTextNodes(DOMNodeList $nodesToSearch, $callback) { foreach($nodesToSearch as $curNode) { if($curNode-hasChildNodes()) foreach($curNode-childNodes as $curChild) if($curChild instanceof DOMText) #echo TEXT NODE FOUND: . $curChild-nodeValue . PHP_EOL; /// todo: allow use of hook here call_user_func($callback, $curNode, $curChild); } } /** * determine if a node should be modified, by chcking to see if a child is a text node * and the text looks like an email address. * call a subordinate function to convert the text node into a mailto anchor DOMElement */ function convertToLinkIfNecc(DomElement $textContainer, DOMText $textNode) { if( (strtolower($textContainer-nodeName) != 'a') (filter_var($textNode-nodeValue, FILTER_VALIDATE_EMAIL) !== false) ) { convertMailtoToAnchor($textContainer, $textNode); } } /** * modify a DOMElement that has a DOMText node as a child; create a DOMElement * that represents and a tag, and set the value and href attirbute, so that it * acts as a 'mailto' link */ function convertMailtoToAnchor(DomElement $textContainer, DOMText $textNode) { $newNode = new DomElement('a', $textNode-nodeValue); $textContainer-replaceChild($newNode, $textNode); $newNode-setAttribute('href', mailto:{$textNode-nodeValue}); }
Re: [PHP] Sending username/password
On Fri, 2008-09-05 at 15:37 -0500, Jay Moore wrote: :) Sorry bout that. However, malformed URL bugs that cause your system to crash can't really be attributed to me ;) Cheers, Rob. The prompt that showed before my computer self-destructed referenced you specifically. Expect the invoice for my new quantum computer to come in the mail shortly. I trust you will remit payment promptly. I'd hate to have to get the internet police involved. I hear they're itchin' to taze you, bro. I sent your payment via quantum mail... let me know if it gets entangled along the way. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
On Fri, 2008-09-05 at 15:39 -0500, Jay Moore wrote: That'll teach you to use Google Chrome. ;) Pshaw. IE5 4 lyfe, yo. I have IE5 running in a vmware appliance. I check sites in it once in a while for kicks :) I also have IE 3 running and Netscape 4. It's amazing how ugly the new tech looks when you go retro... though still looks good if you go retro to wget ;) I should track down a copy of mosaic for giggles. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
On Fri, 2008-09-05 at 17:45 -0400, Robert Cummings wrote: On Fri, 2008-09-05 at 15:39 -0500, Jay Moore wrote: That'll teach you to use Google Chrome. ;) Pshaw. IE5 4 lyfe, yo. I have IE5 running in a vmware appliance. I check sites in it once in a while for kicks :) I also have IE 3 running and Netscape 4. It's amazing how ugly the new tech looks when you go retro... though still looks good if you go retro to wget ;) Err, I meant retro to links or lynx. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using DOM textContent Property
bouncing back to the list so that others may benefit from our work... On Fri, Sep 5, 2008 at 3:09 PM, Tim Gustafson [EMAIL PROTECTED] wrote: Nathan, Thanks for the suggestion, but it's still not working for me. Here's my code: === $HTML = new DOMDocument(); @$HTML-loadHTML($text); $Elements = $HTML-getElementsByTagName(*); for ($X = 0; $X $Elements-length; $X++) { $Element = $Elements-item($X); if ($Element-tagName == a) { # SNIP - Do something with A tags here } else if ($Element instanceof DOMText) { echo $Element-nodeValue; exit; } } === This loop never executes the instanceof part of the code. If I add: } else if ($Element instanceof DOMNode) { echo foo!; exit; } Then it echos foo! as expected. It just seems that none of the nodes in the tree are DOMText nodes. In fact, get_class($Element) returns DOMElement for every node in the tree. Tim, i got your code working with minimal effort by pulling in two of the methods i posted and making some revisions. scope it out, (this will produce the same output as my last post (the part after OUT:)) ?php $text = 'htmlbodyTestbrh2[EMAIL PROTECTED]a name=barstuff inside the link/aFoo/h2pcare/ppyoyser/p/body/html'; $HTML = new DOMDocument(); $HTML-loadHTML($text); $Elements = $HTML-getElementsByTagName(*); for ($X = 0; $X $Elements-length; $X++) { $Element = $Elements-item($X); if($Element-hasChildNodes()) foreach($Element-childNodes as $curChild) if ($curChild-nodeName == a) { # SNIP - Do something with A tags here } else if ($curChild instanceof DOMText) { convertToLinkIfNecc($Element, $curChild); } } echo $HTML-saveXML() . PHP_EOL; function convertToLinkIfNecc(DomElement $textContainer, DOMText $textNode) { if( (strtolower($textContainer-nodeName) != 'a') (filter_var($textNode-nodeValue, FILTER_VALIDATE_EMAIL) !== false) ) { convertMailtoToAnchor($textContainer, $textNode); } } function convertMailtoToAnchor(DomElement $textContainer, DOMText $textNode) { $newNode = new DomElement('a', $textNode-nodeValue); $textContainer-replaceChild($newNode, $textNode); $newNode-setAttribute('href', mailto:{$textNode-nodeValue}); } ? so, the problem is iterating over a tree structure will only show you whats at the first level of the tree. this is why you need to call hasChildNodes(), and if that is true, call childNodes() and iterate across that (and really, the code should be doing the same thing there as well, calling hasChildNodes() and iterating over the results of childNodes()). the code i have shown will work for the html i posted, however it wont work on (x)html where these text nodes we're searching for are deeper in the tree than the second level. im sure you can cook up something that will recurse down to the leafs :) anyway, im going to try and hook up a RecursiveDOMDocumentIterator that implements RecursiveIterator so that it has the convenient foreach support. also, ill probly try to hook up a Filter varient of this class so that situations like this are trivial. stay tuned :D -nathan