Advertising Script from PHP to Node.js for Ghost?


#1

Is there Anyone out there, who can help me to solve this Problem of “how-to” convert a Script (Ad Serving) written in PHP into Node.js ??

A somehow little Description…
WHY, you may ask now would i want to kinda ruin my Ghost Blog with some Advertising?
Because it’s not the ordinary Advertising with Banners or Layers and this kind of Crap, but a Backlink thingy. I use this kind of Ad-Seller for most of my Projects over a Decade now and i am very pleased with there Service, mostly because i haven’t any troubles in all the Time that has past.

I am NOT a Programmer nor a Developer, just a Blogger who wants to switch from WordPress to Ghost completely in the long Run.

If there is Someone out there/here who can do the Job, its not without paying for your Work. I will have a few Euros to spare for This and the original Company will gladly be involved as well to pay you. Of course i’am in Contact with them, they support my Efforts.

I tried to publish my Question within the Commercial Section but it didn’t worked out, so i put it here for now. Feel free to move it, if necessary.

(Yes, i am no native English speaker but i will try as best as i can. So be patient with me.)


#2

Can you share the script? This might help people help you!

There is more difference between Ghost and WordPress than just Node.js vs PHP. In WP PHP is used to render all the pages, and you can have plugins. Ghost, whilst written in Node.js behind the scenes, uses handlebars to render pages and has no concept of plugins, only themes.

In an ideal world, whatever script you wanted to drop into your theme would be written in client-side JavaScript and then would work for both Ghost & WP. It sounds like what you have is more akin to a plugin, and might be fundamentally tricky to make work with Ghost.


#3

Hm, that sounds really kind of tricky to me.

Besides that, i included the Script as followed so maybe on that Way i can finde Someone willing to help to solve my kinda Problem.

backlinkseller.de is the Company behind this.

//URL, die zu der Seite Ihrer Webpräsenz führt (z.B. http://www.example.com/my_page/)
//Die Defaulteinstellung muss in den meisten Fällen nicht geändert werden
requestUri = _SERVER[‘REQUEST_URI’];
if(substr($requestUri, 0, 1) == ‘/’) {$requestUri = substr($requestUri, 1);} //remove leading slash
$requestUri = str_replace(‘http://my-top-level.tld/’, ‘’, $requestUri); //make sure that request uri is without domain
$BACKLINK_SELLER[‘PAGE_URL’] = ‘http://MyUrlProject.tld/’ . $requestUri;

function backlinkseller($config)
{
$request = ‘/channel/?id=’ . $config[‘ID’] . ‘&page=’ . urlencode(config['PAGE_URL']) . '&ip=' . _SERVER[‘REMOTE_ADDR’];
if($config[‘DEBUG_FLAG’]) {$request .= ‘&debug=1’;}
$tld = ‘de’;
@$socket = fsockopen(‘channel8.backlinkseller.’ . $tld, 80, $errorNumber, $errorMessage, 5);
if(!$socket)
{
$tld = ‘com’;
@$socket = fsockopen(‘channel8.backlinkseller.’ . $tld, 80, $errorNumber, $errorMessage, 5);
if(!$socket) {return ‘’;}
}
$response = null;
stream_set_timeout($socket, 5);
fwrite($socket, ‘GET ’ . $request . " HTTP/1.1\r\nHost: channel8.backlinkseller." . $tld . “\r\n\r\n”);
$response = fread($socket, 1000000);
fclose($socket);
if(strpos($response, “\r\n\r\n”) !== false) {$response = trim(substr($response, strpos($response, “\r\n\r\n”)));}
$response = str_replace(array(’"’, “\’”), array(’"’, “’”), $response); //remove quotes
if(strpos($response, ‘’) === false || strpos($response, ‘’) === false) {return ‘’;}
$response = str_replace(array(’’, ‘’), ‘’, $response);
return $response;
}
echo(backlinkseller($BACKLINK_SELLER));

?>


#4

How about this?

The company that made that php script should be able to make something out of this and then you can have a javascript that you load in the header/footer through ghost code injection settings?