1,105,644 Community Members

Ajax request using PHP forwarding

Member Avatar
otengkwaku
Junior Poster
108 posts since Mar 2012
Reputation Points: 20 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 10 [?]
 
0
 
<?php  
  header('Content-Type: application/xml');  
  $tmpFile = 'tmpFile.txt';  
  $val = $_GET["http://rss.news.yahoo.com/rss/us.rss"]; 
  echo ($val); 
  $curlHandle = curl_init($val);  
  $filePointer = fopen($tmpFile, "w");  
  curl_setopt($curlHandle, CURLOPT_FILE, $filePointer);  
  curl_exec($curlHandle);  
  curl_close($curlHandle);  
  fclose($filePointer);  
  $linesArr = file($tmpFile);  
  foreach($linesArr as $eachLine){  
    echo($eachLine);  
  }  
?>

I don't know why this code is not working. Can someone help me

Member Avatar
diafol
Where are my eyes?
12,983 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,848 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

What's this:

 $val = $_GET["http://rss.news.yahoo.com/rss/us.rss"];

Do you have a querystring with a parameter of that name? Sounds unlikely.

Member Avatar
otengkwaku
Junior Poster
108 posts since Mar 2012
Reputation Points: 20 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 10 [?]
 
0
 

sorry for that it is realy $val = $_GET["fwd"]

the posted code is to get the content of a web site and save it in a file

Member Avatar
diafol
Where are my eyes?
12,983 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,848 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

I followed the link and it doesn't seem to exist.

Member Avatar
otengkwaku
Junior Poster
108 posts since Mar 2012
Reputation Points: 20 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 10 [?]
 
0
 

but should the code on the whole work?
when i run the code with a deffrent url it gives me the error

<b>Notice</b>:  Undefined index: https://www.google.com in <b>C:\Users\spirit\Documents\xampp\htdocs\News-Reader-Code\news-web-code\bridge2.php</b> on line <b>4</b><br />
Member Avatar
diafol
Where are my eyes?
12,983 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,848 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

sounds like you are still using the weird key:

$val = $_GET["http://www.google.com"]; 

?

Question Answered as of 1 Year Ago by diafol
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: