
![]() |
nutballs
For some reason using the webrequest class in the manner of my framework is not working. It does work on another site, on the same server, without my framework. Obviously its something with my framework but again, just not seeing it. It runs the execution, but nothing gets returned from the remote server. If i hit the same server using just this:
$xml = new SimpleXMLElement(file_get_contents($url)); it can grab the content. application->scrapesomething gets called from my presentation page, but no need to show that. debug output simpleGet: Starts with [http://www.asu.edu] Outbound Header: GET HTTP/1.1 Host: www.asu.edu User-Agent: Accept: Accept-Language: Accept-Encoding: Accept-Charset: Connection: close Content-Type: text/html Content-Length: 0 Default beforeExecute() Execute: Starts Execute: HostStr=[www.asu.edu] Port:80 Execute: PHP5 or greater, setting timeout ofExecute: Sending request Execute: Request Sent GetChunk: Starts getChunk: Remote Timeout handleProxyRetry() Execute: Failed - Did not receive anything from remote host handleFailure() Default afterExecute() simpleGet Failed Array ( ) My application class - stripped down class application { private function scrapesomething() { //Get the URLs to scrape $url= "http://www.asu.edu"; $req = &$GLOBALS['webrequest']; //this is the global reference to the webrequest object instance in the presentation page. $req->debugMode = WRD_ECHO; $req->method = 'GET'; //for some reason if i dont put this, it wont default to get, and it fails. clue? $result = $req->simpleGet($url); print_r($req->getHeaders()); } } only thing that was added to perks webrequest class was this constructor to enable global access to a single object. (per my framework) function __construct() { if ($GLOBALS['webrequest']) { $GLOBALS['messages']->adderr('webrequest.class. phpis being constructed more than once.');} else { $GLOBALS['webrequest'] = &$this; } } nutballs
I ran some more tests, such as instantiating the webrequest object from within the application->function.
still no worky. but the result from debug is different. simpleGet: Starts with [http://www.mit.edu] Outbound Header: GET HTTP/1.1 Host: www.mit.edu User-Agent: Mozilla/5.0 ( Macintosh; U; PPCMacOS X; en)AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.8Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: Accept-Charset: ISO-8859-1,utf-8:q=0.7,*;q=0.7 Connection: close Content-Type: text/html Content-Length: 0 Default beforeExecute() Execute: Starts Execute: HostStr=[www.mit.edu] Port:80 Execute: PHP5 or greater, setting timeout of 30Execute: Sending request Execute: Request Sent GetChunk: Starts GetChunk: Received 2988 processHeaders: Starts processHeaders: Result Code is processHeaders: Array Follows Array ( ) Execute: Successful Retrieve postProcess: Content length is 0 handleSuccess() Default afterExecute() Execute: Completes simpleGet Failed Array ( ) perkiset
NB - how you're using it is unfamiliar to me so I'll try to ring you up later and get more symptoms and example source
/p nutballs
i dunno. my framework seems to be having issues. particularly the database class. My methodology of assigning each object to a global variable is not working. Weird behavior is afoot.
like doing a "select * from table where something=somethingelse limit 2" and then looping, actually processes 7 rows... LOL conceptually I like my framework, but I have a feeling it just is too open to weirdness. Unless its just that Im not understanding phpand its intricacies.perkiset
I've been wanting to talk to you re. "frameworks" in any case.
I've noticed something extremely similar about your's and my trajectories, moving from large compiled language IDEs into this new realm. The most important thing I can say is that I had a gorgeous, full featured capital-F Framework written in Kylix and Delphi that was the basis for all of my sites. It was the most efficient and best way to do things. I wrote my first couple passes at a PHP-based framework the same way. It was lush and full, chock full of all kinds of mechanisms that I thought would really make my futurePHPlife better.Now my framework (lowercase f) is more a loose confederation of includes than a large single code body. I notice as I get better and better with PHP(I'm in about 2.5 years now) that my code gets lighter, smaller, tighter and faster as I move away from my older notions of Framework into littler classes that I combine and retask more easily. Today, my backoffice framework, for example, LOOKS like it is a big managed app, but actually it's a bunch of pages that happen to work together. It is true that everything flows through a single script and my essentially page construction methodology is the same, but the code that does it is pretty light. My stock retail site script is only a couple hundred lines long now - my basic structure is pretty simple:
I know you'll need to follow a trajectory and explorations at your own pace... just wanted to offer this a gear turner because you seem a bit frustrated by the complexity of it. I get it. ![]() /p nutballs
I fully agree.
The main problem i am trying to tackle though is codebase-consistency. If i deploy custom apps to 5 different clients, all of which are built using the same framework, I can easily update security handling for example, by just dropping the new class class file into each site. In an ideal world, all my stuff would operate via RPC, but that is unrealistic with latency and such. My framework is not complicated, and is only to provide the bare minimum of consistent functionalities that every single site i make has. Such as database connectivity and SQL injection defense access security both page level and inpage level template management and display security (XSS defense) messaging general configuration class with site specific constants like database logins for example helpers like a dateadd function. thats really it. everything else is just piled into one giant ass application class. The only reason is consistency. nutballs
thats really weird. my constructor to globalize the object actually prevents it from functioning. Im sure if i actually took some time to read though all your code I would realize why, but alas, I am a lazy bastard and just barreling through stuff for now. So pffft. moving onward and just using the class locally when needed.
perkiset
Alas.
![]() nutballs
You are just jealous of my mastery of archaic english.
![]() perkiset
It's a fair cop.
|

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads