Forum Moderators: coopster
A few weeks ago I posted here to ask how to get the html of a page which is dependent on cookies.
The only suggestion people came up with was curl.
Problem is my tech level aint high enough to install curl. There's no good tutorial which explains me how to install curl on windows. Even when I find a tutorial I don't understand what they are saying.
Is there any way to load the html of a site dependent on cookies in a variable (using php)?
Or do you know of any great premade packages out there?
Hope you can help me
Thanks in advance,
Thierry
I got php 4.xx installed on windows
I downloaded this version of curl
[curl.haxx.se...]
I got the dll files for ssl in my system folder
When i take a look at the files in the downloaded curl.
There's a curl.exe which doens't do much of anything
when running php it tells me
Php_curl.dll not found
When i search my pc for this dll it's nowhere to be found.
What am i doing wrong?
Installation
To use PHP's CURL support you must also compile PHP --with-curl[=DIR] where DIR is the location of the directory containing the lib and include directories. In the "include" directory there should be a folder named "curl" which should contain the easy.h and curl.h files. There should be a file named libcurl.a located in the "lib" directory. Beginning with PHP 4.3.0 you can configure PHP to use CURL for URL streams --with-curlwrappers.
1. Copied libeay32.dll and ssleay32.dll to c:\windows\system32
2. Edited my PHP.ini file un-commenting extension=php_curl.dll
3. Checked what my extension directory was (extension_dir = "./")
4. Copied php_curl.dll from my c:\php\extensions directory to c:\php directory.
That was it. Tested it using $cp = curl_init(); and worked fine.
Hope this helps you.
Andrew McCarron
I have used another method on my WinXP:
1. Add C:\php5 (my php503 root) to the path, Environment var
2. Uncomment extension=php_curl.dll
3. Set extension_dir = "c:/php5/ext"
I have ested it by using $cp = curl_init() and phpinfo(), and it worked fine.
In Phpinfo it shows following
CURL support ¦ enabled
CURL Information ¦ libcurl/7.11.2 OpenSSL/0.9.7c zlib/1.1.4
Regards
1. Open a connection to the host using fsockopen()
2. Create the HTTP request headers. Example:
$headers = "GET /path/to/file.php?var=something HTTP/1.0\r\n";
$headers .= "Host: www.example.com:80\r\n";
$headers .= "Cookie: cookie_name=cookie_value; cookie2=value2 \r\n\r\n";
3. Write those headers to the socket created by fsockopen using fwrite or fputs
4. Read the response (headers + html) from the socket using file reading functions such as fread, fgets, etc
5. You're done.
It's also much faster the cURL.