473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

PHP Proxy failing to load pages

5
I use a php proxy that works fine but when i try to use it in this url fails if you take out the proxy call it works here is the link
this one works fine
http://yoursite.com/xml_proxy.php?rl=http://rss.cnn.com/rss/cnn_topstories.rss



http://site.com/Proxy1.php?url=http://flickr.com/services/rest/?method=flickr.photos.search&tags=geotagged&tag_mo de=all&per_page=5&page=1&extras=geo&bbox=-180%2C-90%2C180%2C90&api_key=82831e02041ba02034cba9a3fb36 2e8b

if you take out the proxy call works fine
here is the proxy code what can be the error
thanks in advance
r.soler
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $post_data = $HTTP_RAW_POST_DATA;
  4.  
  5. $header[] = "Content-type: application/atom+xml,application/xml,text/xml,text/plain";
  6. $header[] = "Content-length: ".strlen($post_data);
  7.  
  8. $ch = curl_init( $_GET['url'] ); 
  9. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  10. curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  11. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  12.  
  13. if ( strlen($post_data)>0 ){
  14.     curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  15. }
  16.  
  17. $response = curl_exec($ch);     
  18.  
  19. if (curl_errno($ch)) {
  20.     print curl_error($ch);
  21. } else {
  22.     curl_close($ch);
  23.     print $response;
  24. }
Aug 9 '07 #1
4 17652
pbmods
5,821 Expert 4TB
Heya, R. Soler. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

Changed thread title to better describe the problem (did you know that threads whose titles contain phrases such as, 'problem' actually get FEWER responses?).

What do you want your code to do? Give an example.
What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Aug 9 '07 #2
rsoler
5
THANKS FOR YOUR SUGGESTIONS

The code is supposed to bring back the values used later to proccess instead when used from proxy call returns
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?> 
  2. - <rsp stat="fail">
  3.   <err code="112" msg="Method "unknown" not found" /> 
  4.   </rsp>
if i take out the proxy call and execute directly the response is
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?> 
  2. - <rsp stat="ok">
  3. - <photos page="1" pages="122112" perpage="5" total="610558">
  4.   <photo id="1069021419" owner="10984112@N05" secret="c044986b55" server="1140" farm="2" title="narnia - up close and personal" ispublic="1" isfriend="0" isfamily="0" latitude="-17.918" longitude="25.782833" accuracy="16" /> 
  5.   <photo id="1069771956" owner="94636189@N00" secret="d18ef45e91" server="1232" farm="2" title="Siberian Plain" ispublic="1" isfriend="0" isfamily="0" latitude="54.634257" longitude="83.25242" accuracy="16" /> 
  6.   <photo id="1068910847" owner="94636189@N00" secret="ae160522c9" server="1390" farm="2" title="Mongol Rally 2007" ispublic="1" isfriend="0" isfamily="0" latitude="54.634108" longitude="83.252163" accuracy="16" /> 
  7.   <photo id="1068912619" owner="94636189@N00" secret="15cc031c64" server="1234" farm="2" title="Fake Road Police Car" ispublic="1" isfriend="0" isfamily="0" latitude="54.633661" longitude="83.252335" accuracy="16" /> 
  8.   <photo id="1068805905" owner="24845565@N00" secret="a164d01d74" server="1094" farm="2" title="New racks in Brisbane Square" ispublic="1" isfriend="0" isfamily="0" latitude="-27.471306" longitude="153.022637" accuracy="16" /> 
  9.   </photos>
  10.   </rsp>
Aug 10 '07 #3
pbmods
5,821 Expert 4TB
R. Soler, please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
Aug 10 '07 #4
pbmods
5,821 Expert 4TB
Heya, R. Soler.

Try urlencode()ing the URL before sending it to your PHP proxy page.

E.g.:
http://site.com/Proxy1.php?url=http%3A%2F%2Fflickr.com%2Fservices% 2Frest%2F%3Fmethod%3Dflickr.photos.search%26tags%3 Dgeotagged%26tag_mode%3Dall%26per_page%3D5%26page% 3D1%26extras%3Dgeo%26bbox%3D-180%252C-90%252C180%252C90%26api_key%3D82831e02041ba02034cb a9a3fb362e8b

Instead of:
http://site.com/Proxy1.php?url=http://flickr.com/services/rest/?method=flickr.photos.search&tags=geotagged&tag_mo de=all&per_page=5&page=1&extras=geo&bbox=-180%2C-90%2C180%2C90&api_key=82831e02041ba02034cba9a3fb36 2e8b
Aug 10 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: John Sheppard | last post by:
Hello there, I am unsure as to where to ask for help about this, so I thought I might try here. Our website works correctly for 99.9% of customers, however we have one set of customers who...
2
by: Manfred Braun | last post by:
Hi All, I am trying to access xml-files in the internet from my intranet-page. Making XmlDocument.Load() calls internally works fine, but not so to the internet. I think the calls are failing,...
0
by: etnaelk | last post by:
Hi all, I have a real bugger of a problem that I just haven't been able to figure out. I am working on writing my own proxy server in C# using TcpListener, TcpClient, HttpWebRequest/Response and...
2
by: =?Utf-8?B?TGVuc3Rlcg==?= | last post by:
A C# (.NET 2) application which uses the System.Net.HttpWebRequest object to request a resource over HTTPS is failing following the installation of a new proxy server on our internal network with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.