Solved

Curl problem

Posted on 2008-06-19
3
377 Views
Last Modified: 2008-06-19
Hi,
I am using the following code

        $ch = curl_init("http://www.mortgages.ie/rates_new.cfm");
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);      
        curl_close($ch);
        echo $output;

the output i get is 1, i dont get the whole page displayed?
0
Comment
Question by:markmchugh
3 Comments
 
LVL 2

Expert Comment

by:kszurek
ID: 21821347
Mayby:
echo file_get_contents('http://www.mortgages.ie/rates_new.cfm');

Open in new window

0
 
LVL 19

Expert Comment

by:bevhost
ID: 21821372
why is the CURLOPT_POST there?
there isn't any data to POST.
Should be a GET.
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 21821405
The code is working, but the URL you quers does not return anything or has a protection against script usage.

If you use:
$ch = curl_init("http://www.example.com/");
$ch = curl_init("http://www.mortgages.ie/mortgages/rates.cfm");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.8.1.14) Gecko/20080410 SUSE/2.0.0.14-2.3 Firefox/2.0.0.14');
$output = curl_exec($ch);
curl_close($ch);
echo $output;


it works
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now