/    Sign up×
Community /Pin to ProfileBookmark

problems using post between two sites…

Hi,

I would like to collaborate with an other site than mine. The idea would be to exchange links to search something using the post method (for safety purpose). We did not manage. we use the following but do not see any output, such as the search performed on the other site… what are we doing wrong ?
thanks for any help !

[code=php]<?php
function send_headers ($fp) {
fputs ($fp, “Accept: */*n”);
fputs ($fp, “Accept-Language: enn”);
fputs ($fp, “Connection: Keep-Aliven”);
fputs ($fp, “User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)n”);
}

function post_data ($host, $url, $data) {
$fp = @fsockopen ($host, 80, $errno, $errstr, 120);
$ret = “”;
if (strncasecmp ($url, “http://”, 7) == 0) $url = substr ($url, 7);
$p = strpos ($url, ‘/’);
if (empty ($p)) {
$req = “/”;
} else {
$req = substr ($url, $p);
}
if ($fp) {
fputs ($fp, “POST $req HTTP/1.0n”);
send_headers ($fp);
fputs ($fp, “Content-type: application/x-www-form-urlencodedn”);
$out = “”;
while (list ($k, $v) = each ($data)) {
if(strlen($out) != 0) $out .= “&”;
$out .= rawurlencode($k). “=” .rawurlencode($v);
}
$out = trim ($out);
fputs ($fp, “Content-length: “.strlen($out).”nn”);
fputs ($fp, “$out”);
fputs ($fp, “n”);
while(!feof($fp)){
$ret .= fgets($fp,128);
}
fclose ($fp);
}
return $ret;
}
// what we do ….
$search=”car”;
$argument=”red”;
$reply = post_data (“www.something.com”, “/submit.php”, array (“model” => $search, “color” => $argument));

?>[/code]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@ellisglAug 01.2007 — Can you access their database?
×

Success!

Help @patimages spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...