|
Hi,
I need to know what's wrong in this code that can't show any data using CURL -
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://search.msn.com/results.aspx?q=test&FORM=MSNH");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data1=curl_exec($ch);
echo "<font color=black face=verdana size=3>".$data1."</font>";
echo curl_error($ch);
curl_close($ch);
?>
Nothing is showing ..
N.B.: My Curl is enabled.
modified on Monday, June 27, 2011 11:23 PM
|
|
|
|
|
Hi!
I'd like to know if there's a way I can call a javascript variable in a php function?
Like for example, the code below would get the value of textbox text1 when the button is clicked. It should call the javascript function with a parameter. That javascript function calls the PHP function with a javascript variable nVal.
<?php
Function ShowNumber($nValue) {
$nTotal = $nValue + 1;
Return $nTotal;
}
?>
<script language="javascript">
Fuction PassNumber(nVal) {
alert("<?php ShowNumber("+nVal+"); ?>");
}
</script>
<input type="text" name="text1" value="200" /><br />
<input type="button" value="Go" onClick="PassNumber(this.text1.value)" />
Thanks.
|
|
|
|
|
No. If you really want to get a value into Javascript from PHP without reloading the page, the way to do it is using AJAX.
|
|
|
|
|
You have to think about it this way:
PHP code works with what the server "knows".
Javascript code works with what the browser / client "knows".
To get them to interact, you need to explicitly "pass" information back and forth between the two.
For example, if you have a variable in the javascript, you can "pass" the value to the server by passing it with a GET variable, e.g.
<script language="javascript">
Fuction PassNumber(nVal) {
location.href = 'mypage.php?n='+nVal;
}
</script>
Then, on the server side, you receive the GET variable to produce the effect that you want:
<?php
$nval = $_GET['n'];
if ($nval)
{
print('<script>alert('.$nval.');</script>');
}
?>
Contrariwise, when you have the PHP variable on the server side, you can use that to feed it to the Javascript function when rendering your onclick function:
<input type="text" name="text1" value="200" /><br />
<input type="button" value="Go" onClick="PassNumber(this.text1.value+<?php print($nval) ?>)" />
This requires a re-load of the page, and change of URL, each time you click the button. To do it more "subtley", without a reload, you would have to use AJAX: but the principle would be the same. Pass the information between Server and Browser using calls to the PHP page with GET.
--Greg
|
|
|
|
|
Hi all,
This is about Drupal (may be related with configurations)
I've configured Drupal correctly, and after the all configurations I'm on my new site now. I can see so many link on the page such as Dashboard and so on.
But when I click on any of the link on my site, all of them redirect to the folder/file list on the browser. How can I fix that?
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Step 1: Take a browser to the Drupal users forum at drupal.org[^]
Step 2: Look at the extensive documentation there, particularly in the "Forums and groups" section.
Step 3, if you are still stuck: Sign up and post a message to the Drupal support forum explaining your problem. They are a helpful bunch. (I have to say that, I'm one of them. )
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I have already check with the documentation but couldn't find a proper solution.
So I have post my question over here, and just on drupal forum as well.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Did anyone of you comes with this issue?
So far no luck. I am searching the web since yesterday.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Hi there,
I'm writing a small(ish) Python app that is designed to play a list of sounds. Ever seen QLab? A bit like that.
The problem I have is this: I have a threading.Timer that (at the moment) prints to the console that a sound has finished playing - it will change the UI, eventually, but the printout is all I need for now - but the timer does not wait until the interval is complete before it fires the function.
Code:
playout_1_timer = threading.Timer(10.0,musicDone)
playout_1_timer.start()
def musicDone():
print "Music finished playing"
However, the timer does not wait the 10 seconds as it should, and calls musicDone as soon as .start() is called.
What's going on?
Thanks,
icemclean
|
|
|
|
|
try this:
import threading
def musicDone():
print("Music finished playing")
playout_1_timer = threading.Timer(10.0, musicDone)
playout_1_timer.start()
David
|
|
|
|
|
Hello
I'm new in here. I have concept to make project. but i don't know what i need for this project.
It will be mobile balance recharge system. It will be in two part.
1st: web site part.(client will go there ,they login and put number and amount to recharge.)
2nd recharge server part.(Rechage Data will sync from website,and automatically recharge sync number by USB Modem. it will reply back to server recharge status.
from website each user will be balance. from there they can send money to another mobile.
Like that project what i need to know and how i can devolop the software and php web site.
Here is an example what will be the system www.autoflexiserver.com { they use 6 modem for 6 mobile oparator and 1 modem for internet.
Anybody can help me plz
Looking for php code.
|
|
|
|
|
rabbyweb wrote: Looking for php code
People wont give you code here. If you want one, try researching them using Google, and if you're stuck on an issue on the code, then you might want to post the code here. People will be much happier to help if you also help yourself.
Good judgment comes from experience, and experience comes from bad judgment. Barry LePatner
|
|
|
|
|
hello guys
i work my final project using php mysql
that program is find sorted path from store to other store (each store have coordinat in map),then the program list the path in the table in one page after user press submit button, so user can choose the sorted path
my method is simulated annealing,
can some one help me because i'm newbe in php
thank's for replay
|
|
|
|
|
Please I urgently need an online exam or test script in PHP and MYSQL. i haven't been able to find any one yet. thanks
you can reply me via email: eoakinyemi02@gmail.com
|
|
|
|
|
You dont need to post your email here unless you want to invite spams. Im not sure if I understand you correctly but if you are looking for online exams, there are plenty if you just use Google. For test scripts, I'm not sure about your reason why you need them.
Good judgment comes from experience, and experience comes from bad judgment. Barry LePatner
|
|
|
|
|
Hi,
I recommend a site where you can really build your site for free. There you can test your php and mysql script.
This is the site. http://0fees.net
|
|
|
|
|
have you tried looking in hotscripts.com?
Chris J
www.redash.org
|
|
|
|
|
|
This is foxing me a little and I wonder if someone could point me in the right direction please or include what is needed to resolve this.
My page at the moment only includes the following and the address(URL) is given as the example.
<?php
$url = $_SERVER['REQUEST_URI'];
echo $url;
?>
The return is...
/jh6k95/index.php
However the only thing I want from that is...
jh6k95
So, I suppose the question is how do I strip out folder name.
Many thanks in advance for any help.
Ray
|
|
|
|
|
There are several ways to do it, so these are the most simple options that I can think of.
1. Use dirname[^] to get the parent directory name (if you are sure that the URL always contains the filename):
<?php
$url = $_SERVER['REQUEST_URI'];
$dir = trim(dirname($url), '/');
2. Use explode[^] to break the path into an array:
<?php
$url = $_SERVER['REQUEST_URI'];
$parts = explode('/', trim($url, '/'));
$dir = $parts[0];
I've used trim[^] in both of these to remove leading and trailing '/' characters.
|
|
|
|
|
Thank You Graham,
The first one only gives me \ for some reason but the question is answered with the second one you gave.
Many Thanks
Regards
Ray
|
|
|
|
|
Hello all,
I'm trying to keep the page still... without luck...
In one of the pages I'm making I have a list of divs that are giving an effect of rows in a listctrl... you know one is gray, the next one white, the third gray again and so on...
In each of those rows there is a link that allows me to show/hide a form that is at the bottom of each div (I'm using some code like this one[^]).
If the complete page doesn't fit into the explorer window, each time that I press that link the page moves to the top giving the user a strange feeling as the user has to search again the content that needs in the page...
How could I maintain it at the same position?
Thank you in advance!
|
|
|
|
|
One simple solution to this problem would be to focus on an anchor (<a> tag) or one of the form fields that you're dynamically showing, e.g.:
function focusOn(elementId) {
getElementById(elementId).focus();
}
I assume this is required because the page must be reloaded when you're showing the form controls? A better solution may be to just have them on the page all the time, but using the
display:none CSS style, and then set the one you want to be visible.
Hope this helps!
Cheers!
|
|
|
|
|
Hello all_in_flames (I hope you are well ),
I've tried the first option about the <a> tag... this semi-works as the page gets moved as before but a little bit better as it shows the content centered...
Also tried to use focus()... without luck... it seems it don't work for me...
function toggle(id)
{
var e = document.getElementById(id);
if(e.style.display == 'block')
{
e.style.display = 'none';
e.focus();
}
else
{
e.style.display = 'block';
e.focus();
}
}
then arriving at your last recommendation... I think it is how I'm doing it right now... I've put all the content there but the style is display:none and I "only" show and hide it... This has been my initial approach and the behavior is not what I want...
Any idea on what should I do?
Thank you in advance!
|
|
|
|
|
There are only a small subset of HTML elements that can accept focus. I believe all of the input fields (text boxes, check and radio boxes, etc) and anchor tags are able to accept a focus() call. I would pass the id of an element that can be focused on as well as the id of the element to be shown/hidden:
function toggle(toggleId, focusId)
{
var e = document.getElementById(toggleId);
var f = document.getElementById(focusId);
if(e.style.display == 'block')
{
e.style.display = 'none';
f.focus();
}
else
{
e.style.display = 'block';
f.focus();
}
}
Good luck!
|
|
|
|