小编buk*_*ski的帖子

如何在php中接收xml请求并发送响应xml?

所以我需要构建一个接收xml请求的应用程序,基于此我将不得不返回响应xml.我知道如何发送请求并收到响应,但我从来没有这样做过.我会像这样发送请求:

private function sendRequest($requestXML)
{
    $server = 'http://www.something.com/myapp';
    $headers = array(
    "Content-type: text/xml"
    ,"Content-length: ".strlen($requestXML)
    ,"Connection: close"
    );

    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, $server);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 100);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $requestXML);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $data = curl_exec($ch);



    if(curl_errno($ch)){
        print curl_error($ch);
        echo "  something went wrong..... try later";
    }else{
        curl_close($ch);
    }

    return $data;

}
Run Code Online (Sandbox Code Playgroud)

我的问题是 - 接收方的代码是什么?我如何捕获传入的请求?谢谢.

php xml api

14
推荐指数
1
解决办法
4万
查看次数

动态设置组件的道具

我需要在组件存储在变量中之后设置它的道具,这里是伪代码:

render(){

    let items = [{title:'hello'}, {title:'world'}];
    let component = false;

    switch (id) {
      case 1:
        component = <A />
        break;
      case 2:
        component = <B />
        break;      
    }

    return(
      items.map((item, index)=>{
        return(
          <span>
            {/* SOMETHING LIKE THIS WOULD BE COOL - IS THAT EVEN POSSIBLE*/}
            {component.props.set('title', item.title)}
          </span>11

        )
      })
    )
  }
Run Code Online (Sandbox Code Playgroud)

在里面return我运行一个循环,我需要为存储在变量中的组件设置道具....如何设置我之前存储在变量中的组件的道具?

jsx reactjs react-jsx

14
推荐指数
2
解决办法
2万
查看次数

添加SASS以弹出create-react-app配置

我想.scss在我的应用程序中添加支持,这是使用create-react-app创建的.

我确实弹出npm run eject并安装了必要的依赖项:npm install sass-loader node-sass --save-dev

在里面config/webpack.config.dev.js我添加到加载器这个片段:

{
   test: /\.scss$/,
   include: paths.appSrc,
   loaders: ["style", "css", "scss"]
},
Run Code Online (Sandbox Code Playgroud)

所以loaders数组的开头现在看起来像这样:

loaders: [
      // Process JS with Babel.
      {
        test: /\.(js|jsx)$/,
        include: paths.appSrc,
        loader: 'babel',
        query: require('./babel.dev')
      },
      // "postcss" loader applies autoprefixer to our CSS.
      // "css" loader resolves paths in CSS and adds assets as dependencies.
      // "style" loader turns CSS into JS modules that inject <style> tags.
      // In production, we …
Run Code Online (Sandbox Code Playgroud)

sass reactjs webpack create-react-app

11
推荐指数
3
解决办法
1万
查看次数

Codeigniter没有输入文件指定错误

我已在子网站www.siteb.com/rexona中安装了CI

我的.htaccess在www.siteb.com/rexona内:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /rexona

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#‘system’ can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn’t true it sends the
#request to …
Run Code Online (Sandbox Code Playgroud)

php codeigniter

6
推荐指数
1
解决办法
2万
查看次数

如何使用curl正确发送和接收XML?

我一直试图发布XML并从服务器获得响应,但没有运气.

以下是服务器端的条件:

  • 对服务器的请求应通过HTTP 1.1以XML格式发送.

以下要求适用于HTTP请求:

  • 请求类型应为POST;
  • Content-Length头应该存在,和该请求的总长度应低于16KB;
  • Content-Type头应该存在,包含媒体类型值text/xml;

这是我的脚本:

$url = "http://somedomain.com";
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<Request PartnerID="asasdsadsa" Type="TrackSearch"> <TrackSearch> <Title>love</Title>    <Tags> <MainGenre>Blues</MainGenre> </Tags> <Page Number="1" Size="20"/> </TrackSearch> </Request>';
$header  = "POST HTTP/1.1 \r\n";
$header .= "Content-type: text/xml \r\n";
$header .= "Content-length: ".strlen($xml)." \r\n";
$header .= "Connection: close \r\n\r\n"; 
$header .= $xml;
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
$data = curl_exec($ch); 
echo …
Run Code Online (Sandbox Code Playgroud)

php xml post curl http

5
推荐指数
1
解决办法
3万
查看次数

无法使用ON DELETE SET DEFAULT创建外键

我无法创建外键ON DELETE SET DEFAULT,但如果我使用,ON DELETE CASCADE那么这里的所有作品都是我的sql

CREATE TABLE person(  
    customer_id INT AUTO_INCREMENT PRIMARY KEY,  
    name VARCHAR(100) UNIQUE 
);


CREATE TABLE habits(  
    customer_id INT AUTO_INCREMENT PRIMARY KEY,  
    habit VARCHAR(100) UNIQUE 
);

INSERT INTO `test`.`habits` (`customer_id`, `habit`) VALUES (NULL, 'smoking'), (NULL, 'drinking');
INSERT INTO `test`.`person` (`customer_id`, `name`) VALUES (NULL, 'John'), (NULL, 'Steve');

CREATE TABLE foreigner(  
    customer_id INT AUTO_INCREMENT PRIMARY KEY,  
    customer VARCHAR(100) DEFAULT 'John', 
    habbit  VARCHAR(100) DEFAULT 'smoking', 
    FOREIGN KEY (customer) REFERENCES person(name)  ON DELETE SET DEFAULT ON …
Run Code Online (Sandbox Code Playgroud)

mysql sql database database-design

5
推荐指数
1
解决办法
6558
查看次数

如何让西里尔字母大写?

那么我怎样才能将西里尔字母变成大写?

echo strtoupper("???????");
Run Code Online (Sandbox Code Playgroud)

这不起作用.

php

4
推荐指数
1
解决办法
3326
查看次数

如何在闪存中嵌入flv并使用AS3播放?

我想用几个视频创建一个ipad应用程序.所有视频都必须嵌入闪存中,因此不需要流式传输.我可以通过这种方式在时间轴上嵌入flv,但是还有其他一些方法可以控制回放,使用Actionscript引用库中的视频对象或者在AS中使用嵌入式标签 - 这样我就可以获得更多的控制权并访问提示点.

flash actionscript-3

4
推荐指数
1
解决办法
7745
查看次数

如何在svg中使用混合模式用于矢量形状?

这是我简单的svg:

<!DOCTYPE html>
<html>
<head>
</head>
<body>

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
    <defs>
    <filter id="f1" x="0" y="0">
      <feBlend mode="multiply" in="SourceGraphic" in2="SourceGraphic" />
    </filter>
    </defs>
    <path d='M100 100 L200 100 L200 200 L100 200 Z' fill='#00FFFF'/>
    <path d='M150 150 L250 150 L250 250 L150 250 Z' fill='#CC3300'/>
    <path d='M175 175 L275 175 L275 275 L175 275 Z' fill='#FFFF00'/>
</svg>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

它只是简单的3个矩形形状.是否可以将混合模式MULTIPLY应用于所有三个矩形?

html svg vector-graphics svg-filters

2
推荐指数
1
解决办法
6363
查看次数

使用UTF-8编码将数据从MySQL导出到Excel

我有一个带utf8_general_ci排序规则的mysql行,当我将它导出到csv时,而不是我得到的正确的utf-8字符?…?€¦I等,如何让excel了解UTF-8编码这里是我的代码:

$conn = mysql_connect('localhost', 'root', 'asdfggh') or die(mysql_error());
mysql_query("SET CHARACTER SET utf8"); 
mysql_query("SET NAMES utf8"); 
mysql_select_db('table_name', $conn) or die(mysql_error($conn));

$query = sprintf('SELECT * FROM sudraba_birzs');
$result = mysql_query($query, $conn) or die(mysql_error($conn));

header('Content-Encoding: UTF-8');
header('Content-type: text/csv; charset=UTF-8');
header('Content-Disposition: attachment; filename="'.date("d-m-Y_H:i") . '.csv'.'"'); 
echo "\xef\xbb\xbf";

$row = mysql_fetch_assoc($result);
if ($row) {
    echocsv(array_keys($row));
}

while ($row) {
    echocsv($row);
    $row = mysql_fetch_assoc($result);
}

function echocsv($fields)
{
    $separator = '';
    foreach ($fields as $field) {
        if (preg_match('/\\r|\\n|,|"/', $field)) {
            $field = …
Run Code Online (Sandbox Code Playgroud)

php mysql csv excel

2
推荐指数
1
解决办法
3万
查看次数