所以我一直在多个服务器上得到这个恼人的错误(它是一个警告,所以我忽略它,但我需要这个功能)
警告:curl_setopt()[function.curl-setopt]:启用safe_mode或在第56行的/home/xxx/public_html/xxx.php中设置open_basedir时,无法激活CURLOPT_FOLLOWLOCATION
我将如何通过SSH解决此问题?
我一直在使用curl和PHP.今天我一直在尝试获取http://www.webhostingstuff.com/category/Best-Hosting.html,我不断获得http代码0,这对我来说是新的.
我设置了标题
$s->headers = array(
"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: en-gb,en;q=0.5",
"Accept-Encoding: gzip, deflate",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive: 115",
"Connection: keep-alive",
"Referer: https://google.com"
);
Run Code Online (Sandbox Code Playgroud)
我有一个cookie文件(脚本完成加载时没有任何内容)
这是卷曲功能
function fetch($url, $username='', $data='', $proxy=''){
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
if(isset($proxy)) {
curl_setopt($ch,CURLOPT_TIMEOUT,30);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXYPORT, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'proxyadmin:parola');
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT,true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac …Run Code Online (Sandbox Code Playgroud) 我需要通过CURL和PHP发布关于vbulletin的论坛帖子,看起来不是很难,但是它必须有图像,我可以上传一个图像,但是一旦我添加第二个图像,它似乎只是重定向到我试图发布到论坛的顶级主题?
继承我的代码,似乎发布第二个图像只是改变图像的路径..但它不起作用?
$post = array(
'st' => '0',
'act' => 'Post',
's' => '',
'f' => '157',
'auth_key' => $this->scrape->fetchBetween("<input type='hidden' name='auth_key' value='", "'",$this->scrape->result),
'removeattachid' => '0',
'MAX_FILE_SIZE' => '0',
'CODE' => '01',
'post_key' => $this->scrape->fetchBetween("<input type='hidden' name='post_key' value='", "'",$this->scrape->result),
'TopicTitle' => $data['title'],
'TopicDesc' => '',
'tag' => $tag,
'bbmode' => 'normal',
'ffont' => '0',
'fsize' => '0',
'fcolor' => '0',
'LIST' => 'LIST ',
'helpbox' => 'Image (alt + g) [img]http://www.dom.com/img.gif[/img]',
'tagcount' => '',
'Post' => $description,
'enableemo' => …Run Code Online (Sandbox Code Playgroud) 所以我正在开发一个同时使用jQuery和prototype.js的网站,但是它们存在冲突.
我研究了一下,发现人们解决这个问题的唯一方法就是使用
<script>
jQuery.noConflict();
// Use jQuery via jQuery(...)
jQuery(document).ready(function(){
jQuery(\"div\").hide();
});
// Use Prototype with $(...), etc.
$('someid').hide();
Run Code Online (Sandbox Code Playgroud)
但是我不想将$更改为jQuery,因为这意味着我必须编辑一些预先编写的代码.有没有办法阻止他们冲突,并将jQuery保留为$?
我需要检查一组服务器,路由器和交换机是否还活着.我一直在寻找可以与IP和端口一起工作超过一个小时的可靠的东西,有人可以帮忙吗?
结束使用
function ping($addr, $port='') {
if(empty($port)) {
ob_start();
system('ping -c1 -w1 '.$addr, $return);
ob_end_clean();
if($return == 0) {
return true;
} else {
return false;
}
} else {
$fp = fsockopen("udp://{$addr}", $port, $errno, $errstr);
if (!$fp) {
return false;
} else {
return true;
}
}
}
Run Code Online (Sandbox Code Playgroud) 我已经迁移了服务器并更新了AWS phar,但是一旦我这样做了,我就会收到以下错误:
致命错误:未捕获异常'InvalidArgumentException',消息'缺少必需的客户端配置选项:version:(string)需要"版本"配置值.指定版本约束可确保您的代码不会受到对服务的重大更改的影响.例如,使用Amazon S3时,您可以将API版本锁定为"2006-03-01".您的SDK版本具有以下版本的"email":*"2010-12-01"您可以为"版本"配置值提供"最新",以利用客户端API的最新API版本提供商可以找到.注意:不建议在生产应用程序中使用"最新".可以在每个客户端上找到可用API版本的列表.如果您无法加载特定的API版本,则可能需要更新SDK的副本.in phar:/// /includes/3rdparty/aws/aws.phar/Aws/ in phar:/// /includes/3rdparty/aws/aws.phar/Aws/ClientResolver.php on 328
我试过通过不同的方法添加它并查看实际的文档,没有任何运气.
这是我现在的代码:
$client = SesClient::factory(array(
'user' => 'uuuuu',
'key' => 'aaaaa',
'secret' => 'bbbb',
'region' => 'us-east-1',
));
$client->version("2010-12-01");
//Now that you have the client ready, you can build the message
$msg = array();
//more code after this...
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激!
我已经解决这个问题好几天了,但似乎找不到解决方案。
我正在尝试通过 eBay API 授权以获取用户令牌以进行进一步操作。
当我使用沙箱环境时,一切都很好,但是一旦我使用生产环境,我就会收到以下错误:
{"error":"invalid_client","error_description":"client authentication failed"}
Run Code Online (Sandbox Code Playgroud)
我的文件结构如下:
配置.php:
<?php
/* SAndbox
$config = [
'client_id' => 'xxxxx-xxxxxx-SBX-e55b66fda-63c7e331',
'client_secret' => 'SBX-xxxxxx-dxxxxxb-47cb-9bee-f33b',
'ru_name' => 'xxxxxxxxx-oxxxxas-xxxxxxx-tsuggc',
'login_url' => 'https://auth.sandbox.ebay.com/oauth2/authorize',
'oauth_url' => 'https://api.sandbox.ebay.com/identity/v1/oauth2/token',
'api_scopes' => ['https://api.ebay.com/oauth/api_scope/sell.inventory'],
];
*/
$config = [
'client_id' => 'xxxxxx-CxxxxxxT-PRD-455bfe8ea-7e445131',
'client_secret' => 'PRD-797xxxx7bf-d5xxxc-4a19-axxade-ab8xx6',
'ru_name' => 'xxxxxxx-osxxxxxxas-CxxxxS-hjlalp',
'login_url' => 'https://auth.ebay.com/oauth2/authorize',
'oauth_url' => 'https://api.ebay.com/identity/v1/oauth2/token',
'api_scopes' => ['https://api.ebay.com/oauth/api_scope/sell.inventory'],
];
Run Code Online (Sandbox Code Playgroud)
获取登录.php:
<?php
include_once 'config.php';
$url = $config['login_url'];
$url .= '?client_id='.$config['client_id'];
$url .= '&response_type=code';
$url .= '&redirect_uri='.urlencode($config['ru_name']);
$url .= '&scope='.implode(' ', $config['api_scopes']); …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种方法来检查两个阵列是否相同,例如
$a = array(
'1' => 12,
'3' => 14,
'6' => 11
);
$b = array(
'1' => 12,
'3' => 14,
'6' => 11
);
Run Code Online (Sandbox Code Playgroud)
这两个是相同的,但如果单个值被更改,它将返回false,我知道我可以编写一个函数,但是有一个已经构建了吗?
我的目标是我需要选择第二个选项.
我尝试了以下方法,无法设置选定的值.没有出现错误,选择就不会发生.我自己非常熟悉HTML,我知道"selected"和"selected ="选择"'工作,但不确定为什么它不能使用我的C#代码.可能有什么不对?
webBrowser1.Document.GetElementById("field_gender1").
Children[1].SetAttribute("selected", "selected");
Run Code Online (Sandbox Code Playgroud)
HTML是
<select name="gender1" id="field_gender1" class="select">
<option selected="selected" value="1">val1</option>
<option value="2">val2</option>
</select>
Run Code Online (Sandbox Code Playgroud) 我已经苦苦挣扎了一段时间,我有一个存储在DB中的字符串化JSON对象,一旦我检索它我用PHP和jQuery解码它,PHP工作正常,jQuery失败,继承人代码
var data = $.parseJSON('{"page_name":"Test page","page_title":"Test title","site":"0","page_url":"http:\/\/saulius.epickitdev.com\/test-page","page_type":"1","bg_type":"gradient","background_img_url":"","fill_bg_color":"","background_color":"","background_gradient_top":"5194c4","background_gradient_bottom":"000000","video_type":"yt","youtube_video_url":"","youtube_video_start_from":"","mp4_video_url":"","webm_video_url":"","ogg_video_url":"","width_type":"fixed","width_padding":"10","layout_color":"cc25cc","border_size":"3","border_color":"5a7de6","container_position":"middle","container_position_left":"","container_position_right":"","meta_title":"mtest","meta_description":"mdesc","meta_keyword":"mkey","fb_title":"ftitle","fb_description":"fdesc","header_script":{"1":"<meta name=\"keywords\" content=\"h1\">","2":"<meta name=\"keywords\" content=\"h2\">"},"footer_script":[""],"redirect_url":"","exit_message":""}');
console.log(data);
Run Code Online (Sandbox Code Playgroud)
现在它告诉我错误是:
SyntaxError:JSON.parse:在JSON数据的第1行第766行的对象中的属性值之后的','或'}'
哪个会在'=':
"<meta name=\"keywords\" content=\"h1\">"
Run Code Online (Sandbox Code Playgroud)
有人有任何线索吗?我尝试了不同的解析器,我完全坚持了!