我是一名游戏开发人员,不太熟悉网络编程。我正在尝试将我的网站积分系统MyCred与我的游戏联系起来。Mycred有用于与其他站点的点进行交互的代码片段。我使用了他们的代码片段,但我一直收到以下错误:
致命错误:require():无法打开required“WP\\u DIRwp-blog-header”。php“(include\\u path=”.:/usr/lib/php7.2“)位于http://homepages/24/d773619225/htdocs/clickandbuilds/SefronGames/Gameconnect/KC。php在线
我在网上搜索了一下,并尝试在顶部添加代码来加载wp,但没有成功。仍然抛出错误。以下是我遇到问题的php代码:
<?php
require WP_DIR.\'wp-blog-header.php\';
$secret_key = \'I took this off to protect info\';
$remote_url = \'I took this off to protect info \';
$action = \'CREDIT\';
$account = \'[email protected]\';
$amount = 10;
$ref = \'reference\';
$ref_id = 0;
$entry = \'Points for viewing video\';
$data = \'optional extra\';
$point_type = \'Kanobia Credit\';
$host = get_bloginfo( \'url\' );
$token = md5( $host . $action . $amount . $secret_key );
$request = array(
\'method\' => \'POST\',
\'body\' => array(
\'action\' => $action,
\'account\' => $account,
\'amount\' => $amount,
\'ref\' => $ref,
\'ref_id\' => $ref_id,
\'type\' => $point_type,
\'entry\' => $entry,
\'data\' => $data,
\'token\' => $token,
\'host\' => $host
)
);
$response = wp_remote_post( $remote_url, $request );
?>