如何在PHP中隐藏curl的输出?
我的代码如下:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, PSSWDINFO);
$result= curl_exec ($ch);
curl_close ($ch);
Run Code Online (Sandbox Code Playgroud)
问题是在整个页面上喷出,我怎样才能简单地显示"成功"或"失败"的消息?
我有一个简单的文本输入表单,在提交时,需要获取一个php文件(将输入传递给文件),然后获取结果(只是一行文本)并将其放入a div并淡入div到视图中.
这就是我现在拥有的:
<form id=create method=POST action=create.php>
<input type=text name=url>
<input type="submit" value="Create" />
<div id=created></div>
Run Code Online (Sandbox Code Playgroud)
我需要的是create.php?url=INPUT动态加载到被div调用者的结果created.
我有jquery表单脚本,但我无法让它正常工作.但我确实加载了库(文件).
我有一系列复选框,通过ajax一次加载100个.
我需要这个jquery允许我按下按钮检查屏幕上的所有内容.如果加载了更多,并按下了按钮,或许可以关闭所有关闭,然后再次按下切换所有重新打开.
这就是我所拥有的,显然它不适合我.
$(function () {
$('#selectall').click(function () {
$('#friendslist').find(':checkbox').attr('checked', this.checked);
});
});
Run Code Online (Sandbox Code Playgroud)
按钮是#selectall,复选框是类.tf,它们都驻留在一个父div中#check,在div中调用div #friend,在div中调用#friendslist
例:
<div id='friendslist'>
<div id='friend'>
<div id='check'>
<input type='checkbox' class='tf' name='hurr' value='durr1'>
</div>
</div>
<div id='friend'>
<div id='check'>
<input type='checkbox' class='tf' name='hurr' value='durr2'>
</div>
</div>
<div id='friend'>
<div id='check'>
<input type='checkbox' class='tf' name='hurr' value='durr3'>
</div>
</div>
</div>
<input type='button' id='selectall' value="Select All">
Run Code Online (Sandbox Code Playgroud) 我试图用javascript关闭一个子窗口,在Firefox中一切正常,但在chrome中窗口不关闭
这是我正在使用的
$(document).ready(function() {
if (window.opener && !window.opener.closed)
window.opener.location = "http://www.website.com"
window.close();
});
Run Code Online (Sandbox Code Playgroud)
我尝试了谷歌的建议,但无济于事.
任何有类似问题或知道解决方法的人?
假设我在MySQL表中有50行.我想选择前十(LIMIT 10),但我希望能够在不同的页面上选择下一个10.
那么如何在第10行之后开始我的选择呢?
更新的查询:
mysql_query("
SELECT * FROM `picdb`
WHERE `username` = '$username'
ORDER BY `picid` DESC
LIMIT '$start','$count'
")
Run Code Online (Sandbox Code Playgroud) 我的文本字符串如下所示:
johndoe@domain.com (John Doe)
Run Code Online (Sandbox Code Playgroud)
我需要在@之前得到正确的部分而不是别的.如果重要的话,文本来自一个简单的XML对象.
我的代码看起来像这样:
$authorpre = $key->{"author"};
$re1 = '((?:[a-z][a-z]+))';
if ($c = preg_match_all ("/".$re1."/is", $authorpre, $matches))
{
$author = $matches[1][0];
}
Run Code Online (Sandbox Code Playgroud)
有时用户名可能在@符号前面有数字或下划线,这正是正则表达式停止的地方.
这就是我现在所拥有的
将RSS源绘制到php中,来自rss feed的原始xml读取:
Paul’s Confidence
Run Code Online (Sandbox Code Playgroud)
我到目前为止的PHP就是这个.
$newtitle = $item->title;
$newtitle = utf8_decode($newtitle);
Run Code Online (Sandbox Code Playgroud)
以上回报;
Paul?s Confidence
Run Code Online (Sandbox Code Playgroud)
如果我删除utf_decode,我得到这个
Paul’s Confidence
Run Code Online (Sandbox Code Playgroud)
当我尝试str_replace;
$newtitle = str_replace("”", "", $newtitle);
Run Code Online (Sandbox Code Playgroud)
它不起作用,我得到;
Paul’s Confidence
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?
我正在尝试整理一个简单的RSS小部件(对于我的wordpress博客),它将显示股票或市场列表及其当前价格.
我似乎无法在任何地方找到这个数据的API - 任何人都可以建议这样的事情(也许作为RSS提要?)
我使用以下代码:
function GetTwitterAvatar($username){
$xml = simplexml_load_file("http://twitter.com/users/".$username.".xml");
$imgurl = $xml->profile_image_url;
return $imgurl;
}
function GetTwitterAPILimit($username, $password){
$xml = simplexml_load_file("http://$username:$password@twitter.com/account/rate_limit_status.xml");
$left = $xml->{"remaining-hits"};
$total = $xml->{"hourly-limit"};
return $left."/".$total;
}
Run Code Online (Sandbox Code Playgroud)
并在流无法连接时收到这些错误:
Warning: simplexml_load_file(http://twitter.com/users/****.xml) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://twitter.com/users/****.xml"
Warning: simplexml_load_file(http://...@twitter.com/account/rate_limit_status.xml) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://***:***@twitter.com/account/rate_limit_status.xml" …Run Code Online (Sandbox Code Playgroud) 我有一些待售的物品有2级和3级的定制.设置完成后,用户将它们添加到我的现场购物车中.问题是,如何在结账时将每件物品发送到贝宝?我发现动态按钮的唯一代码仅支持单个项目.
<form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="EMAIL">
<input type="hidden" name="item_name" value="Item #1">
<input type="hidden" name="item_number" value="123456">
<input type="hidden" name="amount" value="7.00">
<input type="hidden" name="shipping" value="0">
<input type="hidden" name="shipping2" value="0">
<input type="hidden" name="handling" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.yoursite.com/thankyou.htm">
<input type="hidden" name="undefined_quantity" value="1">
<input type="image" src="http://images.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
Run Code Online (Sandbox Code Playgroud)
我尝试添加
<input type="hidden" name="item_name_2" value="Item #1">
<input type="hidden" …Run Code Online (Sandbox Code Playgroud) php ×6
javascript ×3
jquery ×2
ajax ×1
api ×1
chrome-ios ×1
curl ×1
html ×1
limit ×1
mysql ×1
pagination ×1
paypal ×1
preg-match ×1
regex ×1
simplexml ×1
wordpress ×1
xml ×1