Link to home
Start Free TrialLog in
Avatar of onyourmark
onyourmark

asked on

PHP and CURL

Hi, I have the following script. I am trying to access
http://search.twitter.com/search?q=Japan
and have the results written to a file, but the file is empty. Can anyone see why and how I can fix it?
Thanks.
<?php
    $curl = curl_init();
    $fp = fopen("somefile.txt", "w");
    curl_setopt ($curl, CURLOPT_URL, "http://search.twitter.com/search?q=Japan");
    curl_setopt($curl, CURLOPT_FILE, $fp);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
 
    $result = curl_exec ($curl);
 
    curl_exec ($curl);
    curl_close ($curl);
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of john2885
john2885

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial