Jump to content

can u find the bug for me ?

- - - - -

  • Please log in to reply
3 replies to this topic

#1
murugavelb

murugavelb

    Newbie

  • Members
  • PipPip
  • 11 posts
<?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,‘Sci/Tech - Google News output=rss’);
$fp = fopen(‘rss.xml’, ‘w’);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec ($ch);
curl_close ($ch);
fclose($fp);
?>

I got the error msg as:
Parse error: syntax error, unexpected ':' in C:\xampp\htdocs\projects\test\cur.php on line 3

#2
rk0r

rk0r

    Newbie

  • Members
  • PipPip
  • 20 posts
This may help

<?php
/**
* Initialize the cURL session
*/
$ch = curl_init();
/**
* Set the URL of the page or file to download.
*/
curl_setopt($ch, CURLOPT_URL,
'http://news.google.com/news?hl=en&topic=t&output=rss');
/**
* Create a new file
*/
$fp = fopen('rss.xml', 'w');
/**
* Ask cURL to write the contents to a file
*/
curl_setopt($ch, CURLOPT_FILE, $fp);
/**
* Execute the cURL session
*/
curl_exec ($ch);
/**
* Close cURL session and file
*/
curl_close ($ch);
fclose($fp);
?>

#3
murugavelb

murugavelb

    Newbie

  • Members
  • PipPip
  • 11 posts
First of all,thanks for ur reply....
ya its executed....
Since i'm a fresher,i dnt know how to display the data...

#4
wcypierre

wcypierre

    Newbie

  • Members
  • PipPip
  • 10 posts
You can directly echo the data by putting this:

echo curl_exec ($ch);






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users