使用php api从条纹对象获取16位数的卡号?(Get 16 digit card number from stripe object using php api?)
我想在支付成功后从条形对象中存储16位数的卡号,并在下次用户付款后使用它。 用户可以很容易地选择卡号和要求cvc等...例如Facebook支付系统。 只是我想存储16位数字代码而不是
$card
对象中的最后4位数字。 这里是反对最后4位数的对象。 当我print_r($customer);
它不显示16位数字,只显示最后4位数组。$card = $customer->sources->data[0]; $Stripe_card=$card->last4;
I want to store 16 digit card number from stripe object after payment succeed and use it after next payment of user . user can easily select card number and ask for cvc and so on... e.g facebook payment system . just i want to store 16 digit code instead of last 4 from
$card
object. here is object to get last 4 digit . when iprint_r($customer);
it dose not show 16 number .it show only last 4 number array.$card = $customer->sources->data[0]; $Stripe_card=$card->last4;
原文:https://stackoverflow.com/questions/49295021
最满意答案
即使您将上下文节点传递给函数,以
/
字符开头的XPath表达式也将始终查询整个文档。要进行相对于上下文节点的查询,可以使用a启动它
.
字符。以下应该达到你想要的:
DomElement block = page.getByXPath("//div[@class='block_of_code']"); System.out.println(block.getByXPath(".//span[@class='red']"));
An XPath expression starting with a
/
character will always query the entire document, even if you pass a context node to the function.To make a query relative to the context node, you can start it with a
.
character.The following should achieve what you want:
DomElement block = page.getByXPath("//div[@class='block_of_code']"); System.out.println(block.getByXPath(".//span[@class='red']"));
相关问答
更多-
HtmlUnit的DomElement无法保存XPath结果的状态(HtmlUnit's DomElement can't save state of XPath result)[2023-04-27]
即使您将上下文节点传递给函数,以/字符开头的XPath表达式也将始终查询整个文档。 要进行相对于上下文节点的查询,可以使用a启动它. 字符。 以下应该达到你想要的: DomElement block = page.getByXPath("//div[@class='block_of_code']"); System.out.println(block.getByXPath(".//span[@class='red']")); An XPath expression starting with a / ch ... -
你有没有尝试过? bot.clickSubmitButton("//div[@id='navGoButton']/input"); 我还建议你看看: getFirstByXPath Have you tried? bot.clickSubmitButton("//div[@id='navGoButton']/input"); I would also recommend you to take a look at: getFirstByXPath
-
有: $p = $dom->getElementsByTagName('body')->item(0); 您正在执行: DOMNodelist::item (请参阅: http : DOMNodelist::item )如果在给定的索引处找不到元素,它将返回NULL 。 但是你并没有检查这种可能性,你只是希望$p不为null。 尝试添加如下内容: if ($p instanceof DOMNode) { // the hasAttributes code } 尽管如果你确定应该有一个body元素,你 ...
-
dom_import_simplexml函数返回DOMElement的实例,该实例没有save方法。 你需要的是一个DOMDocument ,它有一个save方法。 幸运的是,从一个到另一个很容易,因为DOMElement是一种DOMNode ,因此拥有ownerDocument属性 。 请注意, formatOutput属性也是DOMDocument一部分,因此您需要的是: $xmlDom = dom_import_simplexml($sxe)->ownerDocument; $xmlDom->form ...
-
您不需要重新处理数据,您可以说保存此特定节点... foreach($query as $values){ $string[] = $doc->saveHTML($values); } 其中$doc是用作XPath查询基础的文档。 You don't need to reprocess the data, you can just say to save this particular node... foreach($query as $values){ $string[ ...
-
没有什么复杂的: wholeText是DOMText属性,而不是DOMNode属性。 当您的XPath查询的部分//h2/following-sibling::ul/li成功并返回不是DOMText实例的节点时,您自然会获得此错误。 如果你想获得li元素中的文本,使用方便的方法DOMNode::nodeValue是一个好方法。 请注意,此方法也适用于DOMText实例,因为DOMText类继承自DOMNode 。 I was able to solve this problem by checking th ...
-
class IndexController extends Zend_Controller_Action { function getInnerHTML($Node) { $Document = new DOMDocument(); $Document->appendChild($Document->importNode($Node,true)); return $Document->saveHTML(); } functi ...
-
点击google结果页面时HtmlUnit中的JavaScript异常(JavaScript Exception in HtmlUnit when clicking at google result page)[2021-12-14]
看起来像JavaScript-Engine(基于Rhino)非常容易让人感到不安并退出一些脚本问题,其他浏览器仍然能够运行脚本。 我不知道谷歌的脚本是否有错误,但这两行解决了我: JavaScriptEngine engine = client.getJavaScriptEngine(); engine.holdPosponedActions(); 然而,当在多个线程中运行多个htmlunit对象时,仍然可能遇到此错误。 这是解决方法而不是解决方案。 Looks like the JavaScript-E ... -
HtmlTableRow(HtmlUnit)上的xPath无法正常工作(xPath on HtmlTableRow (HtmlUnit) does not work properly)[2023-10-26]
//td[2]应该适用于你提供的XML,所以这很奇怪。 你能试试(//td)[2]吗? //td[2] should work on the XML you provided, so this is strange. Can you try (//td)[2]? -
Xpath没有结果(No result from Xpath)[2022-04-21]
更改XPath表达式将为您提供所需的结果: # `title` is not an attribute, but a tag. titles = tree.xpath('.//title/text()') print(titles) # `td` does not have `href` attribute, but `a` tag. teams = tree.xpath('//tr/td/a[@href]/text()') print(teams) Changing XPath expressions ...