Sign in:
Username:
Password:  
»Forgot your password?

Home | Forum | How to Protect Your Web Form | How to Protect Your Email | Sign Up

Insure yourself from spam! The Anti Spam Insurance Company - ProtectWebForm!

Forum - file_get_contents

PostMessage
gamlis
2006-09-16 08:04:55
function disabled by my hosting comp. allow_url_fopen is enabled. Is
it possible to use that function instead of file_get_contents or how
can I get around it. The support told me to use $data = `wget
http://protectwebform.com.... -O -`;

Can somebody help me to get the correct wget to work with the
protectwebform php code?

Mikael
oleg
2006-09-16 08:33:25
hi,

try to use this code:
---------------------------------------------
if(!function_exists("file_get_contents") {
function file_get_contents($url){
$url_parsed = parse_url($url);
$fd = fsockopen($url_parsed[host], 80);
$data = ''; $header = false;
fputs($fd,"GET ".$url_parsed[path]." HTTP/1.0\r\n");
fputs($fd,"Host: ".$url_parsed[host]."\r\n");
fputs($fd,"Connection: close\r\n\r\n");
while($line = fgets($fd)) {
if($header) $data .= $line;
if(strlen($line) <= 2) $header = true;
}
fclose($fd);
return $data;
}
}
gamlis
2006-09-16 08:45:33
Thanks, but how do I write in $data = ''; and where in the php file do
I put the code, at the top?

Mikael
dtfnyc
2006-09-16 09:10:24
After you add this lines, you will be able to use file_get_contents
function.
add these lines before the protectwebform code.
gamlis
2006-09-16 09:17:59
Parse error: syntax error, unexpected '{'

for this line:
if(!function_exists("file_get_contents") {

Mikael
gamlis
2006-09-16 10:19:35
fopen(), file_get_contents() and include() doesn't work and I have
tried:

if(!function_exists("file_get_contents") {
function file_get_contents($url){
$url_parsed = parse_url($url);
$fd = fsockopen($url_parsed[host], 80);
$data = ''; $header = false;
fputs($fd,"GET ".$url_parsed[path]." HTTP/1.0\r\n");
fputs($fd,"Host: ".$url_parsed[host]."\r\n");
fputs($fd,"Connection: close\r\n\r\n");
while($line = fgets($fd)) {
if($header) $data .= $line;
if(strlen($line) <= 2) $header = true;
}
fclose($fd);
return $data;
}
}
if($_GLOBALS['REQUEST_METHOD'] == 'POST' || count($_POST) > 0) {

$protectwebformresult = @file_get_contents(
"http://protectwebform.com/verify/0000_xxxxxxxxxxxx_" .
$_SERVER['REMOTE_ADDR'] . "/" .
etc etc the whole code
oleg
2006-09-16 14:52:19
ok,
try this one instead of file_get_contents:
function getContents($url){
$fh = popen("wget -q -O - ".$url,"r");
$data = fread($fh,8096);
pclose($fh);
return $data;
}
gamlis
2006-09-16 15:54:57
No errors this time, but no captcha either. When I click the submit
button there is a text:
The image code you have provided does not match the actual one. Hit
the 'back' button of your browser and input the correct code please.

So this part om the code is working, but not the url wrapping.
oleg
2006-09-17 01:44:07
Well, send me html and php files, you are using at webmaster [ at ]
protectwebform.com






Post Reply:

You must be logged in to reply.
Post message
Name: 
Email: 
Url: 




Registered users: 20257

Forms protected: 48458

Further Reading & Anti Spam Resources:

Directory
Search our site for:
 
Web www.protectwebform.com

Get Thunderbird!

    ©Copyright 2006 ProtectWebForm.com. All rights reserved. Read our Privacy Policy

Page copy protected against web site content infringement by Copyscape